Skip to content

Commit 7ba7084

Browse files
committed
Add support for ES6 Symbol used in states or actions
Fix #142.
1 parent ede01ff commit 7ba7084

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

docs/API/Arguments.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ Use `window.__REDUX_DEVTOOLS_EXTENSION__([config])` or `window.__REDUX_DEVTOOLS_
2626
```
2727
- **deserializeAction(action): transformedAction** (*function*) - optional transformation of actions deserialized from debug session (useful if actions are not plain object. Example: immutable-js action payload)
2828
- action, transformedAction - Redux action objects
29-
- **serializeState** (*boolean or function or object*) - specify how and what should be handled during serialization (useful if state is not plain object). Could be:
29+
- **serializeState** (*boolean or function or object*) - specify how and what should be handled during serialization (useful if state is not plain object). It will affect the extension's performance significantly!
30+
Could be:
31+
- `undefined` - use regular `JSON.stringify` to send data - the fast mode.
3032
- `false` - handle only circular references.
31-
- `true` - handle also dates, regexes, undefined, error objects, and functions.
33+
- `true` - handle also dates, regexes, undefined, error objects, symbols, and functions.
3234
- `function(key, value)` - JSON replacer. Example of usage with mori data structures:
3335

3436
```js

src/app/api/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ function stringify(obj, serialize) {
99
}
1010
if (serialize === true) {
1111
return jsan.stringify(obj, function(key, value) {
12-
if (value && value.toJS) { return value.toJS(); }
12+
if (typeof value === 'object' && value.toJS) return value.toJS();
13+
if (typeof value === 'symbol') return String(value);
1314
return value;
1415
}, null, true);
1516
}

0 commit comments

Comments
 (0)