@yuneta/gobj-js 7.26.5 → 7.26.7
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 +22 -7
- package/dist/gobj-js.cjs.js.map +1 -1
- package/dist/gobj-js.cjs.min.js +8 -9
- package/dist/gobj-js.cjs.min.js.map +1 -1
- package/dist/gobj-js.es.js +22 -7
- package/dist/gobj-js.es.js.map +1 -1
- package/dist/gobj-js.es.min.js +77 -78
- package/dist/gobj-js.es.min.js.map +1 -1
- package/dist/gobj-js.iife.js +22 -7
- package/dist/gobj-js.iife.js.map +1 -1
- package/dist/gobj-js.iife.min.js +8 -9
- package/dist/gobj-js.iife.min.js.map +1 -1
- package/dist/gobj-js.umd.js +22 -7
- package/dist/gobj-js.umd.js.map +1 -1
- package/dist/gobj-js.umd.min.js +8 -9
- package/dist/gobj-js.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/gobj-js.es.js
CHANGED
|
@@ -4063,15 +4063,26 @@ function strrchr_split(str, char) {
|
|
|
4063
4063
|
************************************************************/
|
|
4064
4064
|
function kw_delete(gobj, kw, path) {
|
|
4065
4065
|
if (gobj && !is_gobj(gobj)) log_error(`GObj bad instanceof`);
|
|
4066
|
+
const prefix = gobj ? gobj_short_name(gobj) + ": " : "";
|
|
4067
|
+
if (!is_string(path)) {
|
|
4068
|
+
log_error(`${prefix}kw_delete(): path must be a string: ${String(path)}`);
|
|
4069
|
+
return -1;
|
|
4070
|
+
}
|
|
4066
4071
|
let [path_, k] = strrchr_split(path, "`");
|
|
4072
|
+
let v = kw;
|
|
4067
4073
|
if (!empty_string(k)) {
|
|
4068
|
-
|
|
4069
|
-
if (
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
}
|
|
4073
|
-
|
|
4074
|
-
}
|
|
4074
|
+
v = kw_find_path(gobj, kw, path_, true);
|
|
4075
|
+
if (v === void 0) return -1;
|
|
4076
|
+
} else k = path;
|
|
4077
|
+
if (is_array(v)) {
|
|
4078
|
+
log_error(`${prefix}kw_delete(): cannot delete an item of a list: '${path}'`);
|
|
4079
|
+
return -1;
|
|
4080
|
+
}
|
|
4081
|
+
if (!is_object(v) || !Object.prototype.hasOwnProperty.call(v, k)) {
|
|
4082
|
+
log_error(`${prefix}kw_delete(): path not found: '${path}'`);
|
|
4083
|
+
return -1;
|
|
4084
|
+
}
|
|
4085
|
+
delete v[k];
|
|
4075
4086
|
return 0;
|
|
4076
4087
|
}
|
|
4077
4088
|
/************************************************************
|
|
@@ -4423,6 +4434,10 @@ function kw_set_dict_value(gobj, kw, path, value) {
|
|
|
4423
4434
|
log_error("kw is not an object");
|
|
4424
4435
|
return -1;
|
|
4425
4436
|
}
|
|
4437
|
+
if (!is_string(path)) {
|
|
4438
|
+
log_error(`${gobj ? gobj_short_name(gobj) + ": " : ""}kw_set_dict_value(): path must be a string: ${String(path)}`);
|
|
4439
|
+
return -1;
|
|
4440
|
+
}
|
|
4426
4441
|
let ss = path.split("`");
|
|
4427
4442
|
let len = ss.length;
|
|
4428
4443
|
for (let i = 0; i < len; i++) {
|