@yuneta/gobj-js 7.26.8 → 7.26.10
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/gobj-js.cjs.js +48 -19
- package/dist/gobj-js.cjs.js.map +1 -1
- package/dist/gobj-js.cjs.min.js +177 -168
- package/dist/gobj-js.cjs.min.js.map +1 -1
- package/dist/gobj-js.es.js +48 -19
- package/dist/gobj-js.es.js.map +1 -1
- package/dist/gobj-js.es.min.js +24 -15
- package/dist/gobj-js.es.min.js.map +1 -1
- package/dist/gobj-js.iife.js +48 -19
- package/dist/gobj-js.iife.js.map +1 -1
- package/dist/gobj-js.iife.min.js +166 -157
- package/dist/gobj-js.iife.min.js.map +1 -1
- package/dist/gobj-js.umd.js +48 -19
- package/dist/gobj-js.umd.js.map +1 -1
- package/dist/gobj-js.umd.min.js +24 -15
- package/dist/gobj-js.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/gobj-js.umd.min.js
CHANGED
|
@@ -1864,6 +1864,7 @@
|
|
|
1864
1864
|
function Sr(e, t, n, r) {
|
|
1865
1865
|
if (e && !sr(e) && hn("GObj bad instanceof"), !Zn(t)) return hn("kw is not an object"), -1;
|
|
1866
1866
|
if (!tr(n)) return hn(`${e ? et(e) + ": " : ""}kw_set_dict_value(): path must be a string: ${String(n)}`), -1;
|
|
1867
|
+
if ("" === n) return hn((e ? et(e) + ": " : "") + "kw_set_dict_value(): path empty"), -1;
|
|
1867
1868
|
let l = n.split("`"), o = l.length;
|
|
1868
1869
|
for (let s = 0; s < o; s++) {
|
|
1869
1870
|
let i = l[s];
|
|
@@ -1886,7 +1887,19 @@
|
|
|
1886
1887
|
if (e && !sr(e) && hn("GObj bad instanceof"), !Zn(t)) return hn("kw is not an object"), -1;
|
|
1887
1888
|
let o = mr(e, t, n, !1);
|
|
1888
1889
|
if (void 0 === o) {
|
|
1889
|
-
if (!tr(n))
|
|
1890
|
+
if (!tr(n) || function(e, t) {
|
|
1891
|
+
let n = t.split("`"), r = e;
|
|
1892
|
+
for (let e = 0; e < n.length - 1; e++) {
|
|
1893
|
+
if (er(r)) {
|
|
1894
|
+
const t = pr(r, n[e]);
|
|
1895
|
+
if (t < 0) return !1;
|
|
1896
|
+
r = r[t];
|
|
1897
|
+
} else r = Object.prototype.hasOwnProperty.call(r, n[e]) ? r[n[e]] : void 0;
|
|
1898
|
+
if (null == r) return !1;
|
|
1899
|
+
if (!Zn(r) && !er(r)) return !0;
|
|
1900
|
+
}
|
|
1901
|
+
return !1;
|
|
1902
|
+
}(t, n)) return -1;
|
|
1890
1903
|
if (o = {}, Sr(e, t, n, o) < 0) return -1;
|
|
1891
1904
|
}
|
|
1892
1905
|
return Zn(o) ? (br(o, r, l), 0) : (hn(`subdict is not an object: '${n}'`), -1);
|
|
@@ -3175,14 +3188,9 @@
|
|
|
3175
3188
|
if (!tr(n)) return hn(`jdb_delete: path must be a string: ${String(n)}`), null;
|
|
3176
3189
|
let o, s = n.split("`"), i = l;
|
|
3177
3190
|
for (; (o = s.shift()) && !ir(o) && i;) Zn(i) && (i = Or(null, i, e.hook, null, 0)), i = Yr(i, null, o, !1);
|
|
3178
|
-
if (0
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
} else {
|
|
3182
|
-
let t = Or(null, i, e.hook, null, 0), n = Pr(t, r.id);
|
|
3183
|
-
n >= 0 && t.splice(n, 1);
|
|
3184
|
-
}
|
|
3185
|
-
return l;
|
|
3191
|
+
if (!i || 0 !== s.length) return hn(`jdb_delete: path not found in topic '${t}': '${n}'`), null;
|
|
3192
|
+
let _ = er(i) ? i : Or(null, i, e.hook, null, 0), a = Pr(_, r.id);
|
|
3193
|
+
return a < 0 ? (hn(`jdb_delete: record not found in topic '${t}': '${n}' '${r.id}'`), null) : (_.splice(a, 1), l);
|
|
3186
3194
|
}, e.jdb_get = function(e, t, n, r) {
|
|
3187
3195
|
let l = Or(null, Or(null, e, "topics", null, 0), t, null, 0);
|
|
3188
3196
|
return l ? (void 0 === r && (r = !0), Yr(l, e.hook, n, r)) : (hn("jdb_get: topic not found: " + t), null);
|
|
@@ -3195,11 +3203,11 @@
|
|
|
3195
3203
|
return Or(null, n, t, null, 0) || (hn("jdb topic not found: " + t), Tn(n), null);
|
|
3196
3204
|
}, e.jdb_init = function(e, t, n) {
|
|
3197
3205
|
n && (e = Fn(e));
|
|
3198
|
-
let r = Or(null, e, "type", [],
|
|
3199
|
-
Tr(null, e, "hook", "data",
|
|
3200
|
-
let l = Or(null, e, "schema", {},
|
|
3206
|
+
let r = Or(null, e, "type", [], Zt.KW_CREATE);
|
|
3207
|
+
Tr(null, e, "hook", "data", Zt.KW_CREATE);
|
|
3208
|
+
let l = Or(null, e, "schema", {}, Zt.KW_CREATE), o = Or(null, e, "topics", {}, Zt.KW_CREATE);
|
|
3201
3209
|
return Kr(l, function(e, t, n, l) {
|
|
3202
|
-
"__"
|
|
3210
|
+
"__" === t.substring(0, 2) || Zn(n) || Or(null, o, l, Fn(r), Zt.KW_CREATE);
|
|
3203
3211
|
}, t), e;
|
|
3204
3212
|
}, e.jdb_update = function(e, t, n, r) {
|
|
3205
3213
|
let l = Or(null, Or(null, e, "topics", null, 0), t, null, 0);
|
|
@@ -3207,11 +3215,12 @@
|
|
|
3207
3215
|
if (ir(r.id)) return hn("jdb_update: record without id: " + r), Tn(r), null;
|
|
3208
3216
|
if (!tr(n)) return hn(`jdb_update: path must be a string: ${String(n)}`), null;
|
|
3209
3217
|
let o, s = n.split("`"), i = l;
|
|
3210
|
-
for (; (o = s.shift()) && !ir(o) && i;) Zn(i) && (i = Or(null, i, e.hook, [],
|
|
3218
|
+
for (; (o = s.shift()) && !ir(o) && i;) Zn(i) && (i = Or(null, i, e.hook, [], Zt.KW_CREATE)), i = Yr(i, null, o, !1);
|
|
3219
|
+
if (!i || 0 !== s.length) return hn(`jdb_update: path not found in topic '${t}': '${n}'`), null;
|
|
3211
3220
|
if (0 === s.length && i) if (er(i)) i.push(r);
|
|
3212
3221
|
else if (i.id === r.id) Gn(i, r);
|
|
3213
3222
|
else {
|
|
3214
|
-
let t = Or(null, i, e.hook, [],
|
|
3223
|
+
let t = Or(null, i, e.hook, [], Zt.KW_CREATE), n = Yr(t, e.hook, r.id, !1);
|
|
3215
3224
|
n ? Gn(n, r) : t.push(r);
|
|
3216
3225
|
}
|
|
3217
3226
|
return l;
|