@yuneta/gobj-js 7.26.10 → 7.26.11

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.
@@ -3214,16 +3214,17 @@
3214
3214
  if (!l) return hn("jdb_update: topic not found: " + t), null;
3215
3215
  if (ir(r.id)) return hn("jdb_update: record without id: " + r), Tn(r), null;
3216
3216
  if (!tr(n)) return hn(`jdb_update: path must be a string: ${String(n)}`), null;
3217
- let o, s = n.split("`"), i = l;
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;
3220
- if (0 === s.length && i) if (er(i)) i.push(r);
3221
- else if (i.id === r.id) Gn(i, r);
3217
+ let o, s, i = n.split("`"), _ = l;
3218
+ for (; (o = i.shift()) && !ir(o) && _;) Zn(_) && (_ = Or(null, _, e.hook, null, 0)), _ = Yr(_, null, o, !1);
3219
+ if (!_ || 0 !== i.length) return hn(`jdb_update: path not found in topic '${t}': '${n}'`), null;
3220
+ if (er(_)) s = _;
3222
3221
  else {
3223
- let t = Or(null, i, e.hook, [], Zt.KW_CREATE), n = Yr(t, e.hook, r.id, !1);
3224
- n ? Gn(n, r) : t.push(r);
3222
+ if (_.id === r.id) return Gn(_, r), l;
3223
+ if (s = Or(null, _, e.hook, null, 0), null == s) s = [], Yn(_, e.hook, s);
3224
+ else if (!er(s)) return hn(`jdb_update: the hook '${e.hook}' of '${n}' is not a list in topic '${t}'`), null;
3225
3225
  }
3226
- return l;
3226
+ let a = Yr(s, e.hook, r.id, !1);
3227
+ return a ? Gn(a, r) : s.push(r), l;
3227
3228
  }, e.json2flat = function(e) {
3228
3229
  const t = {}, n = (e, r, l) => {
3229
3230
  if (l > ll) throw new Error("json2flat: deeper than 256");