Skip to content

Commit

Permalink
Add support for ES6 Symbol used in states or actions
Browse files Browse the repository at this point in the history
Fix #142.
  • Loading branch information
zalmoxisus committed Oct 26, 2016
1 parent ede01ff commit 7ba7084
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions docs/API/Arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ Use `window.__REDUX_DEVTOOLS_EXTENSION__([config])` or `window.__REDUX_DEVTOOLS_
```
- **deserializeAction(action): transformedAction** (*function*) - optional transformation of actions deserialized from debug session (useful if actions are not plain object. Example: immutable-js action payload)
- action, transformedAction - Redux action objects
- **serializeState** (*boolean or function or object*) - specify how and what should be handled during serialization (useful if state is not plain object). Could be:
- **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!
Could be:
- `undefined` - use regular `JSON.stringify` to send data - the fast mode.
- `false` - handle only circular references.
- `true` - handle also dates, regexes, undefined, error objects, and functions.
- `true` - handle also dates, regexes, undefined, error objects, symbols, and functions.
- `function(key, value)` - JSON replacer. Example of usage with mori data structures:

```js
Expand Down
3 changes: 2 additions & 1 deletion src/app/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ function stringify(obj, serialize) {
}
if (serialize === true) {
return jsan.stringify(obj, function(key, value) {
if (value && value.toJS) { return value.toJS(); }
if (typeof value === 'object' && value.toJS) return value.toJS();
if (typeof value === 'symbol') return String(value);
return value;
}, null, true);
}
Expand Down

0 comments on commit 7ba7084

Please sign in to comment.