@yuneta/gobj-js 7.25.2 → 7.25.3

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.
@@ -3606,10 +3606,13 @@ var gobjJs = (function(exports) {
3606
3606
  }
3607
3607
  /************************************************************
3608
3608
  * As the C kw_get_bool(): a boolean found is the answer, and
3609
- * anything else gives the default back -- unless KW_WILD_NUMBER
3610
- * asks to read a number (0 is false), a string ("true"/"false"
3611
- * in any case, else its integer) or null (false). Before gobj-js
3612
- * 7.25.2 the value went through Boolean(), so "false" was TRUE.
3609
+ * anything else gives the default back, LOGGED ("path MUST BE a
3610
+ * json boolean", required or not) -- unless KW_WILD_NUMBER asks
3611
+ * to read a number (0 is false), a string ("true"/"false" in any
3612
+ * case, else its integer) or null (false); a list or a dict is
3613
+ * then false, logged too. Before gobj-js 7.25.2 the value went
3614
+ * through Boolean(), so "false" was TRUE; before 7.25.3 a value
3615
+ * of the wrong type gave the default back in silence.
3613
3616
  ************************************************************/
3614
3617
  function kw_get_bool(gobj, kw, path, default_value, flag) {
3615
3618
  if (gobj && !is_gobj(gobj)) log_error(`GObj bad instanceof`);
@@ -3637,11 +3640,13 @@ var gobjJs = (function(exports) {
3637
3640
  else if (b.toLowerCase() === "false") value = false;
3638
3641
  else value = (parseInt(b) || 0) !== 0;
3639
3642
  } else if (wild && b === null) value = false;
3640
- else {
3641
- if (required) {
3642
- log_error(`${gobj_short_name(gobj)}: path value MUST BE a boolean: ${path}`);
3643
- trace_msg(kw);
3644
- }
3643
+ else if (wild) {
3644
+ log_error(`${gobj ? gobj_short_name(gobj) + ": " : ""}path MUST BE a simple json element: '${path}'`);
3645
+ trace_json(kw);
3646
+ return false;
3647
+ } else {
3648
+ log_error(`${gobj ? gobj_short_name(gobj) + ": " : ""}path MUST BE a json boolean: '${path}'`);
3649
+ trace_json(kw);
3645
3650
  return Boolean(default_value);
3646
3651
  }
3647
3652
  if (extract) kw_delete(gobj, kw, path);