@instantdb/core 0.22.86-experimental.split-store.20183617880.1 → 0.22.86-experimental.split-store.20243647937.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/store.d.ts.map +1 -1
- package/dist/commonjs/store.js +12 -11
- package/dist/commonjs/store.js.map +1 -1
- package/dist/esm/store.d.ts.map +1 -1
- package/dist/esm/store.js +12 -11
- package/dist/esm/store.js.map +1 -1
- package/dist/standalone/index.js +73 -73
- package/dist/standalone/index.umd.cjs +1 -1
- package/package.json +2 -2
- package/src/store.ts +14 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instantdb/core",
|
|
3
|
-
"version": "0.22.86-experimental.split-store.
|
|
3
|
+
"version": "0.22.86-experimental.split-store.20243647937.1",
|
|
4
4
|
"description": "Instant's core local abstraction",
|
|
5
5
|
"homepage": "https://github.com/instantdb/instant/tree/main/client/packages/core",
|
|
6
6
|
"repository": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"mutative": "^1.0.10",
|
|
55
55
|
"uuid": "^11.1.0",
|
|
56
|
-
"@instantdb/version": "0.22.86-experimental.split-store.
|
|
56
|
+
"@instantdb/version": "0.22.86-experimental.split-store.20243647937.1"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"test": "vitest",
|
package/src/store.ts
CHANGED
|
@@ -201,19 +201,22 @@ function deleteInMap(m, path) {
|
|
|
201
201
|
deleteInMap(m.get(head), tail);
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
function setInMap(m, path, value) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
204
|
+
function setInMap(m: Map<any, any>, path: any[], value: any) {
|
|
205
|
+
let current = m;
|
|
206
|
+
const lastI = path.length - 1;
|
|
207
|
+
for (let i = 0; i < lastI; i++) {
|
|
208
|
+
const part = path[i];
|
|
209
|
+
|
|
210
|
+
let nextMap = current.get(part);
|
|
211
|
+
if (nextMap === undefined) {
|
|
212
|
+
nextMap = new Map();
|
|
213
|
+
current.set(part, nextMap);
|
|
214
|
+
}
|
|
215
|
+
current = nextMap;
|
|
209
216
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (!nextM) {
|
|
213
|
-
nextM = new Map();
|
|
214
|
-
m.set(head, nextM);
|
|
217
|
+
if (lastI > -1) {
|
|
218
|
+
current.set(path[lastI], value);
|
|
215
219
|
}
|
|
216
|
-
setInMap(nextM, tail, value);
|
|
217
220
|
}
|
|
218
221
|
|
|
219
222
|
function isDateAttr(attr: InstantDBAttr) {
|