@codescouts/svelte-store
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -6,7 +6,8 @@ import { StateCreator } from "zustand/vanilla"; | ||
}; | ||
type Creator<T> = () => T; | ||
type Return<T> = { | ||
build: () => T; | ||
build: () => Creator<T>; | ||
}; | ||
export declare const create: <T>(stateCreator: StateCreator<T, [], [], T>) => { | ||
build: () => T; | ||
build: () => Creator<T>; | ||
withPersist: { | ||
@@ -13,0 +14,0 @@ <E>(entityType: string | Newly<E>, factory: Factory): Return<T>; |
@@ -8,9 +8,9 @@ "use strict"; | ||
var store_extensions_1 = require("./store.extensions"); | ||
var zustandToSvelte = function (zustandStore) { | ||
var definedStore = zustandStore.getState(); | ||
Object.entries(definedStore).forEach(function (e) { | ||
var key = e[0]; | ||
var element = definedStore[key]; | ||
var zustandToSvelte = function (store) { | ||
var state = store.getState(); | ||
Object.keys(state).forEach(function (_key) { | ||
var key = _key; | ||
var element = state[key]; | ||
var withSubscription = (0, store_1.readable)(element, function (set) { | ||
var subscribed = zustandStore.subscribe(function (value) { return set(value[key]); }); | ||
var subscribed = store.subscribe(function (value) { return set(value[key]); }); | ||
return function () { return subscribed(); }; | ||
@@ -20,3 +20,3 @@ }); | ||
}); | ||
return function () { return definedStore; }; | ||
return function () { return state; }; | ||
}; | ||
@@ -23,0 +23,0 @@ var create = function (stateCreator) { |
{ | ||
"name": "@codescouts/svelte-store", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "./lib/index.js", | ||
@@ -11,3 +11,4 @@ "types": "./lib/index.d.ts", | ||
"build": "tsc", | ||
"start": "tsc -w" | ||
"start": "tsc -w", | ||
"test": "jest" | ||
}, | ||
@@ -18,3 +19,20 @@ "dependencies": { | ||
"zustand": "^4.3.7" | ||
}, | ||
"devDependencies": { | ||
"jest": "^29.5.0", | ||
"ts-jest": "^29.1.0" | ||
}, | ||
"jest": { | ||
"roots": [ | ||
"src/", | ||
"test" | ||
], | ||
"testMatch": [ | ||
"/__tests__/.*\\.(ts|tsx|js)", | ||
"**/?(*.)(spec|test).ts?(x)" | ||
], | ||
"transform": { | ||
"^.+\\.tsx?$": "ts-jest" | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
42911
41
418
2
1