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