Skip to content

Commit

Permalink
Update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Jan 17, 2020
1 parent a105b4f commit 00d11d5
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion docs/api/otherExports.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,26 @@ Redux Toolkit exports some of its internal utilities, and re-exports additional

Creates an instance of the `serializable-state-invariant` middleware described in [`getDefaultMiddleware`](./getDefaultMiddleware.md).

Accepts an options object with `isSerializable` and `getEntries` parameters. The former, `isSerializable`, will be used to determine if a value is considered serializable or not. If not provided, this defaults to `isPlain`. The latter, `getEntries`, will be used to retrieve nested values. If not provided, `Object.entries` will be used by default.
Accepts a single configuration object parameter, with the following options:

```ts
function createSerializableStateInvariantMiddleware({
// The function to check if a value is considered serializable.
// This function is applied recursively to every value contained in the state.
// Defaults to `isPlain()`.
isSerializable?: (value: any) => boolean
// The function that will be used to retrieve entries from each value.
// If unspecified, `Object.entries` will be used.
// Defaults to `undefined`.
getEntries?: (value: any) => [string, any][]
// An array of action types to ignore when checking for serializability.
// Defaults to []
ignoredActions?: string[]
// An array of dot-separated path strings to ignore when checking for serializability.
// Defaults to []
ignoredPaths?: string[]
})
```

Example:

Expand Down

0 comments on commit 00d11d5

Please sign in to comment.