From f38e6e487a633b12481c482a1b935899f69edf42 Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Sun, 19 May 2019 05:27:31 -0400 Subject: [PATCH] (refactor): change ordering of `jsonify` to match README - it really should've been second to begin with, but I destructured it out once I was already done and didn't think about / realize that --- persist.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/persist.js b/persist.js index 70cd515..509a765 100644 --- a/persist.js +++ b/persist.js @@ -3,14 +3,14 @@ import { onSnapshot, applySnapshot } from 'mobx-state-tree' import * as LocalStorage from './localStorageAdaptor.js' export const persist = (name, store, options = {}) => { - let {storage, whitelist, blacklist, jsonify} = options + let {storage, jsonify, whitelist, blacklist} = options if (typeof window.localStorage !== 'undefined' && window.localStorage === storage) { storage = LocalStorage } + if (!jsonify) { jsonify = true } // default to true like mobx-persist const whitelistDict = arrToDict(whitelist) const blacklistDict = arrToDict(blacklist) - if (!jsonify) { jsonify = true } // default to true like mobx-persist onSnapshot(store, (_snapshot) => { const snapshot = { ..._snapshot }