@yuneta/gobj-js 7.28.0 → 7.29.0
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/README.md +1 -1
- package/dist/gobj-js.cjs.js +30 -15
- package/dist/gobj-js.cjs.js.map +1 -1
- package/dist/gobj-js.cjs.min.js +5 -4
- package/dist/gobj-js.cjs.min.js.map +1 -1
- package/dist/gobj-js.es.js +30 -15
- package/dist/gobj-js.es.js.map +1 -1
- package/dist/gobj-js.es.min.js +5 -4
- package/dist/gobj-js.es.min.js.map +1 -1
- package/dist/gobj-js.iife.js +30 -15
- package/dist/gobj-js.iife.js.map +1 -1
- package/dist/gobj-js.iife.min.js +5 -4
- package/dist/gobj-js.iife.min.js.map +1 -1
- package/dist/gobj-js.umd.js +30 -15
- package/dist/gobj-js.umd.js.map +1 -1
- package/dist/gobj-js.umd.min.js +5 -4
- package/dist/gobj-js.umd.min.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -920,7 +920,7 @@ gobj_set_trace_machine_format(1) // 1 = simpler (DEFAULT), 0 = legacy
|
|
|
920
920
|
|
|
921
921
|
One line per transition against three. Both name the event, so anything that
|
|
922
922
|
reads the trace back by event name works across the switch. Every line is
|
|
923
|
-
prefixed by its nesting depth (
|
|
923
|
+
prefixed by its nesting depth (four spaces per level of `__inside__`), so an
|
|
924
924
|
event sent from inside another one's action is indented under it — **keep that
|
|
925
925
|
indentation when you render the line somewhere else**; it is the only thing
|
|
926
926
|
that says a transition happened *during* another.
|
package/dist/gobj-js.cjs.js
CHANGED
|
@@ -427,7 +427,7 @@ var Event_Type = class {
|
|
|
427
427
|
}
|
|
428
428
|
};
|
|
429
429
|
function tab() {
|
|
430
|
-
return " ".repeat(Math.max(1, __inside__ *
|
|
430
|
+
return " ".repeat(Math.max(1, __inside__ * 4));
|
|
431
431
|
}
|
|
432
432
|
var __trace_machine_format__ = 1;
|
|
433
433
|
function gobj_set_trace_machine_format(format) {
|
|
@@ -7544,28 +7544,43 @@ function debounce(func, wait = 0, immediate = false) {
|
|
|
7544
7544
|
* Build a URL/path from segments, ensuring exactly one '/'
|
|
7545
7545
|
* between each part.
|
|
7546
7546
|
*
|
|
7547
|
-
* - The first segment keeps its leading '/'
|
|
7548
|
-
* not (relative)
|
|
7549
|
-
*
|
|
7550
|
-
* - Leading '/'
|
|
7547
|
+
* - The first segment is the ROOT: it keeps its leading '/'
|
|
7548
|
+
* (absolute) or not (relative), and its trailing '/' are
|
|
7549
|
+
* stripped -- but a root made only of '/' stays "/".
|
|
7550
|
+
* - Leading and trailing '/' are stripped from every later
|
|
7551
|
+
* segment, and duplicate '/' inside it are collapsed.
|
|
7552
|
+
* - '.' and '..' of the later segments are resolved, and '..'
|
|
7553
|
+
* never rises above the root: ("/store", "../../etc") is
|
|
7554
|
+
* "/store/etc".
|
|
7551
7555
|
* - Empty/null/undefined segments are skipped.
|
|
7552
7556
|
*
|
|
7553
|
-
* Mirrors the C helper build_path() from gobj-c/src/helpers.c
|
|
7557
|
+
* Mirrors the C helper build_path() from gobj-c/src/helpers.c
|
|
7558
|
+
* (tests/build_path.test.js pins the same cases). Up to 7.28.1
|
|
7559
|
+
* a root "/" was lost (("/", "tmp") gave "tmp") and '.'/'..'
|
|
7560
|
+
* were kept as they came.
|
|
7554
7561
|
************************************************************/
|
|
7555
7562
|
function build_path(...segments) {
|
|
7556
|
-
let
|
|
7557
|
-
let
|
|
7563
|
+
let root = null;
|
|
7564
|
+
let tail = [];
|
|
7558
7565
|
for (let segment of segments) {
|
|
7559
7566
|
if (segment == null || segment === "") continue;
|
|
7560
7567
|
segment = String(segment);
|
|
7561
|
-
if (
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7568
|
+
if (root === null) {
|
|
7569
|
+
root = segment.replace(/(.)\/+$/, "$1");
|
|
7570
|
+
continue;
|
|
7571
|
+
}
|
|
7572
|
+
for (let component of segment.split("/")) {
|
|
7573
|
+
if (component === "" || component === ".") continue;
|
|
7574
|
+
if (component === "..") {
|
|
7575
|
+
tail.pop();
|
|
7576
|
+
continue;
|
|
7577
|
+
}
|
|
7578
|
+
tail.push(component);
|
|
7579
|
+
}
|
|
7567
7580
|
}
|
|
7568
|
-
return
|
|
7581
|
+
if (root === null) return "";
|
|
7582
|
+
if (tail.length === 0) return root;
|
|
7583
|
+
return root + (root.endsWith("/") ? "" : "/") + tail.join("/");
|
|
7569
7584
|
}
|
|
7570
7585
|
/***************************************
|
|
7571
7586
|
* Flat json (id -> value)
|