From eebc3642510dc3e2e6626fe5f22ee446b220b8bc Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Wed, 13 Nov 2019 20:14:58 -0500 Subject: [PATCH] (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 --- src/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 9d0cbff..7abf635 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,7 +14,7 @@ export interface IOptions { type StrToAnyMap = {[key: string]: any} export const persist: IArgs = (name, store, options = {}) => { - let {storage, jsonify, whitelist, blacklist} = options + let {storage, jsonify = true, whitelist, blacklist} = options // use AsyncLocalStorage by default (or if localStorage was passed in) if ( @@ -30,7 +30,6 @@ export const persist: IArgs = (name, store, options = {}) => { 'engine via the `storage:` option.') } - if (!jsonify) { jsonify = true } // default to true like mobx-persist const whitelistDict = arrToDict(whitelist) const blacklistDict = arrToDict(blacklist)