From adc248f6395cb7319f5db97c2208bd8bceb089f9 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sat, 25 Nov 2017 14:02:24 -0500 Subject: [PATCH] make target store optional --- store.js | 3 ++- test/store/index.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/store.js b/store.js index 2c573b247f..9c3962d63b 100644 --- a/store.js +++ b/store.js @@ -149,7 +149,8 @@ assign(Store.prototype, { } }); -function combineStores(store, children) { +function combineStores(children, store) { + if (!store) store = new Store(); var updates = {}; for (const key in children) { diff --git a/test/store/index.js b/test/store/index.js index 2f5666152c..246e655229 100644 --- a/test/store/index.js +++ b/test/store/index.js @@ -160,7 +160,7 @@ describe.only('store', () => { b.compute('z', ['x', 'y'], (x, y) => x + y); - const c = combineStores(new Store(), { a, b }); + const c = combineStores({ a, b }); c.compute('total', ['a', 'b'], (a, b) => a.z + b.z);