@yuneta/gobj-js 7.26.6 → 7.26.8

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.
@@ -4068,6 +4068,10 @@
4068
4068
  function kw_delete(gobj, kw, path) {
4069
4069
  if (gobj && !is_gobj(gobj)) log_error(`GObj bad instanceof`);
4070
4070
  const prefix = gobj ? gobj_short_name(gobj) + ": " : "";
4071
+ if (!is_string(path)) {
4072
+ log_error(`${prefix}kw_delete(): path must be a string: ${String(path)}`);
4073
+ return -1;
4074
+ }
4071
4075
  let [path_, k] = strrchr_split(path, "`");
4072
4076
  let v = kw;
4073
4077
  if (!empty_string(k)) {
@@ -4434,6 +4438,10 @@
4434
4438
  log_error("kw is not an object");
4435
4439
  return -1;
4436
4440
  }
4441
+ if (!is_string(path)) {
4442
+ log_error(`${gobj ? gobj_short_name(gobj) + ": " : ""}kw_set_dict_value(): path must be a string: ${String(path)}`);
4443
+ return -1;
4444
+ }
4437
4445
  let ss = path.split("`");
4438
4446
  let len = ss.length;
4439
4447
  for (let i = 0; i < len; i++) {
@@ -4468,9 +4476,14 @@
4468
4476
  log_error("kw is not an object");
4469
4477
  return -1;
4470
4478
  }
4471
- let subdict = kw_get_dict(gobj, kw, path, {}, kw_flag_t.KW_CREATE);
4479
+ let subdict = kw_find_path(gobj, kw, path, false);
4480
+ if (subdict === void 0) {
4481
+ if (!is_string(path)) return -1;
4482
+ subdict = {};
4483
+ if (kw_set_dict_value(gobj, kw, path, subdict) < 0) return -1;
4484
+ }
4472
4485
  if (!is_object(subdict)) {
4473
- log_error("subdict is not an object");
4486
+ log_error(`subdict is not an object: '${path}'`);
4474
4487
  return -1;
4475
4488
  }
4476
4489
  set_own_key(subdict, key, value);
@@ -5217,6 +5230,10 @@
5217
5230
  trace_msg(kw);
5218
5231
  return null;
5219
5232
  }
5233
+ if (!is_string(path)) {
5234
+ log_error(`jdb_update: path must be a string: ${String(path)}`);
5235
+ return null;
5236
+ }
5220
5237
  let ids = path.split("`");
5221
5238
  let id;
5222
5239
  let v = topic;
@@ -5251,6 +5268,10 @@
5251
5268
  trace_msg(kw);
5252
5269
  return null;
5253
5270
  }
5271
+ if (!is_string(path)) {
5272
+ log_error(`jdb_delete: path must be a string: ${String(path)}`);
5273
+ return null;
5274
+ }
5254
5275
  let ids = path.split("`");
5255
5276
  let id;
5256
5277
  let v = topic;