-
0d998dd: Add three new path relationship methods for analyzing and decomposing paths:
-
relativeTo(base)- Extracts the relative path from a base path. Returns the segments that need to be concatenated to the base to produce the full path. Returnsnullif the path doesn't start with the base. This is the inverse operation ofconcat(). -
commonStart(other)- Finds the common prefix path shared between two paths. Returns the longest sequence of segments that both paths start with, or an empty path if no common prefix exists. -
commonEnd(other)- Finds the common suffix path shared between two paths. Returns the longest sequence of segments that both paths end with, or an empty path if no common suffix exists.
These methods enable powerful path decomposition and analysis workflows, such as extracting relative paths for display, finding shared parent paths, and identifying structural similarities between paths.
-
- f9a11f5: Add comprehensive property-based tests using fast-check. Complements existing parametric tests with tests that verify algebraic properties and invariants across thousands of automatically-generated test cases, including round-trip parsing, comparison properties (reflexivity, symmetry, transitivity), manipulation properties (slice/concat identity, associativity), and configuration propagation.
- 275d656: Add
hasIndexWildcardsboolean property to Pathist instances. This property indicates whether the path contains any wildcard index tokens (like*or-1by default), making it easy to check for wildcards without manually inspecting segments.
- ab68e0c: Optimize path string parsing by moving character code constants to module level. This provides ~20% faster constant access compared to class static properties, contributing to an overall ~24% improvement in parsing performance.
- dda8b5f: Optimize path string parsing with substring slicing instead of character-by-character concatenation. This improves performance by up to 3x for paths with long property names, with an average 14% improvement across all parsing operations and no regressions in bracket notation performance.
-
f4ab1c3: Add
match(),matchStart(), andmatchEnd()methods for efficient pattern matching with wildcard support.These new methods return the matched portion of the path with concrete values (not wildcards from the pattern), avoiding redundant parsing compared to manually calling comparison methods and then slicing. All methods return
nullwhen no match is found.match(): Returns the first matched subsequence anywhere in the pathmatchStart(): Returns the matched prefix if the path starts with the patternmatchEnd(): Returns the matched suffix if the path ends with the pattern
These methods are particularly useful for matching error paths against wildcard configuration patterns, such as mapping ArkType error paths to transform configurations.
Example:
const errorPath = Pathist.from(["foo", 2, "bar", "baz"]); const match = errorPath.matchStart("foo[-1].bar"); // Returns: Pathist with ['foo', 2, 'bar'] - preserves concrete index! const remaining = errorPath.slice(match.length); // Returns: Pathist with ['baz']
- d891205: - Fix ./docs
- Improve clarity of README
- Rename
parentmethod toparentPath
-
45936a8: Add internal caching for improved performance:
- Cache
toJSONPointer()andtoJSONPath()results (minimal memory overhead, avoids string building and character escaping on repeated calls) - Cache tree node position lookups using single-scan approach for
firstNodePath(),lastNodePath(),afterNodePath(),nodeIndices(),nodePaths(), andparentNode()(tiny memory footprint with cumulative speedups across 6+ methods)
These optimizations maintain tiny memory usage while providing noticeable performance improvements for common operations, especially in serialization workflows and tree navigation scenarios. The single-scan node position caching computes both first and last node indices together, avoiding redundant segment array iterations.
- Cache