Skip to content

Commit 6b1dd3b

Browse files
committed
(hotfix): jsonify shouldn't set false to true
- meant to use the previous code as an alternative to using a default arg, but `!jsonify` detects false (etc), not just undefined - switched to just using a default arg, which was what I originally used before moving defaults outside of the destructuring - alternative is to check `typeof jsonify === 'undefined'` instead - default args seem to provide better typings in my experience, so stick to that for now
1 parent 10d4cd7 commit 6b1dd3b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/index.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface IOptions {
1414
type StrToAnyMap = {[key: string]: any}
1515

1616
export const persist: IArgs = (name, store, options = {}) => {
17-
let {storage, jsonify, whitelist, blacklist} = options
17+
let {storage, jsonify = true, whitelist, blacklist} = options
1818

1919
// use AsyncLocalStorage by default (or if localStorage was passed in)
2020
if (
@@ -30,7 +30,6 @@ export const persist: IArgs = (name, store, options = {}) => {
3030
'engine via the `storage:` option.')
3131
}
3232

33-
if (!jsonify) { jsonify = true } // default to true like mobx-persist
3433
const whitelistDict = arrToDict(whitelist)
3534
const blacklistDict = arrToDict(blacklist)
3635

0 commit comments

Comments
 (0)