@yuneta/gobj-js 7.16.0 → 7.16.2
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 +31 -6
- package/dist/gobj-js.cjs.js.map +1 -1
- package/dist/gobj-js.cjs.min.js +7 -6
- package/dist/gobj-js.cjs.min.js.map +1 -1
- package/dist/gobj-js.es.js +31 -7
- package/dist/gobj-js.es.js.map +1 -1
- package/dist/gobj-js.es.min.js +505 -503
- package/dist/gobj-js.es.min.js.map +1 -1
- package/dist/gobj-js.iife.js +31 -6
- package/dist/gobj-js.iife.js.map +1 -1
- package/dist/gobj-js.iife.min.js +7 -6
- package/dist/gobj-js.iife.min.js.map +1 -1
- package/dist/gobj-js.umd.js +31 -6
- package/dist/gobj-js.umd.js.map +1 -1
- package/dist/gobj-js.umd.min.js +7 -6
- package/dist/gobj-js.umd.min.js.map +1 -1
- package/package.json +2 -2
package/dist/gobj-js.cjs.js
CHANGED
|
@@ -3269,7 +3269,9 @@ function json_array_size(a) {
|
|
|
3269
3269
|
return 0;
|
|
3270
3270
|
}
|
|
3271
3271
|
/************************************************************
|
|
3272
|
-
*
|
|
3272
|
+
* How much content a json carries: elements of a container,
|
|
3273
|
+
* 1 for a non-empty string, 0 for everything else
|
|
3274
|
+
* (null/undefined, scalars). C twin: json_size() in helpers.h.
|
|
3273
3275
|
************************************************************/
|
|
3274
3276
|
function json_size(a) {
|
|
3275
3277
|
if (is_object(a)) return Object.keys(a).length;
|
|
@@ -3278,6 +3280,22 @@ function json_size(a) {
|
|
|
3278
3280
|
else return 0;
|
|
3279
3281
|
}
|
|
3280
3282
|
/************************************************************
|
|
3283
|
+
* "There is nothing usable here": null/undefined, {}, [],
|
|
3284
|
+
* "" and any scalar. C twin: empty_json() in helpers.h,
|
|
3285
|
+
* where it is the guard to write instead of `if(!jn)` --
|
|
3286
|
+
* there an absent DTP_JSON is json_null(), a valid pointer.
|
|
3287
|
+
* Here `if(!x)` happens to work, and that difference is what
|
|
3288
|
+
* a port across the two runtimes gets wrong: write the same
|
|
3289
|
+
* question in both.
|
|
3290
|
+
*
|
|
3291
|
+
* The other question -- "absent or explicitly null", C's
|
|
3292
|
+
* json_absent() -- is is_null() here, since javascript has
|
|
3293
|
+
* no second null to tell apart.
|
|
3294
|
+
************************************************************/
|
|
3295
|
+
function empty_json(a) {
|
|
3296
|
+
return json_size(a) === 0;
|
|
3297
|
+
}
|
|
3298
|
+
/************************************************************
|
|
3281
3299
|
* Return if a value is an object (excluding arrays & null)
|
|
3282
3300
|
************************************************************/
|
|
3283
3301
|
function is_object(value) {
|
|
@@ -6723,14 +6741,20 @@ function ac_on_message(gobj, event, kw, src) {
|
|
|
6723
6741
|
gobj_send_event(gobj, iev_event, iev_kw, gobj);
|
|
6724
6742
|
return 0;
|
|
6725
6743
|
}
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
if (
|
|
6729
|
-
|
|
6744
|
+
if (!empty_string(iev_dst_service)) {
|
|
6745
|
+
let gobj_service = gobj_find_service(iev_dst_service, false);
|
|
6746
|
+
if (!gobj_service) {
|
|
6747
|
+
log_warning(`${gobj_short_name(gobj)}: event for a service that is gone, DROPPED: service '${iev_dst_service}', ev '${iev_event}'`);
|
|
6748
|
+
return 0;
|
|
6749
|
+
}
|
|
6750
|
+
if (!gobj_has_event(gobj_service, iev_event, event_flag_t.EVF_PUBLIC_EVENT)) {
|
|
6730
6751
|
log_error(`${gobj_short_name(gobj)}: Service found but no event or not public, service '${gobj_short_name(gobj_service)}', ev '${iev_event}'`);
|
|
6731
6752
|
return -1;
|
|
6732
6753
|
}
|
|
6733
|
-
|
|
6754
|
+
gobj_send_event(gobj_service, iev_event, iev_kw, gobj);
|
|
6755
|
+
return 0;
|
|
6756
|
+
}
|
|
6757
|
+
if (gobj_is_pure_child(gobj)) gobj_send_event(gobj_parent(gobj), iev_event, iev_kw, gobj);
|
|
6734
6758
|
else gobj_publish_event(gobj, iev_event, iev_kw);
|
|
6735
6759
|
return 0;
|
|
6736
6760
|
}
|
|
@@ -6907,6 +6931,7 @@ exports.db_save_persistent_attrs = db_save_persistent_attrs;
|
|
|
6907
6931
|
exports.debounce = debounce;
|
|
6908
6932
|
exports.delete_from_list = delete_from_list;
|
|
6909
6933
|
exports.duplicate_objects = duplicate_objects;
|
|
6934
|
+
exports.empty_json = empty_json;
|
|
6910
6935
|
exports.empty_string = empty_string;
|
|
6911
6936
|
exports.escapeHtml = escapeHtml;
|
|
6912
6937
|
exports.event_flag_t = event_flag_t;
|