@finnair/path
Advanced tools
Comparing version 7.2.0 to 7.3.0
@@ -6,2 +6,8 @@ # Change Log | ||
# [7.3.0](https://github.com/finnair/v-validation/compare/v7.2.0...v7.3.0) (2025-01-31) | ||
### Features | ||
- `V.oneOf`reports all results in case of error + fixed cycle detection ([#130](https://github.com/finnair/v-validation/issues/130)) ([c1a2148](https://github.com/finnair/v-validation/commit/c1a214885a9ea0b438b19df7994bf59174b246a0)) | ||
# [7.2.0](https://github.com/finnair/v-validation/compare/v7.1.0...v7.2.0) (2025-01-29) | ||
@@ -8,0 +14,0 @@ |
@@ -8,2 +8,3 @@ export type PathComponent = number | string; | ||
property(property: string): Path; | ||
child(key: number | string): Path; | ||
connectTo(newRootPath: Path): Path; | ||
@@ -13,2 +14,3 @@ concat(childPath: Path): Path; | ||
toJSON(): string; | ||
equals(other: any): boolean; | ||
get length(): number; | ||
@@ -15,0 +17,0 @@ componentAt(index: number): PathComponent; |
@@ -21,2 +21,8 @@ "use strict"; | ||
} | ||
child(key) { | ||
if (typeof key === 'number') { | ||
return this.index(key); | ||
} | ||
return this.property(key); | ||
} | ||
connectTo(newRootPath) { | ||
@@ -38,2 +44,16 @@ return new Path(newRootPath.path.concat(this.path)); | ||
} | ||
equals(other) { | ||
if (other instanceof Path) { | ||
const otherLength = other.length; | ||
if (otherLength === this.length) { | ||
for (let i = 0; i < otherLength; i++) { | ||
if (other.componentAt(i) != this.componentAt(i)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
get length() { | ||
@@ -40,0 +60,0 @@ return this.path.length; |
@@ -8,2 +8,3 @@ export type PathComponent = number | string; | ||
property(property: string): Path; | ||
child(key: number | string): Path; | ||
connectTo(newRootPath: Path): Path; | ||
@@ -13,2 +14,3 @@ concat(childPath: Path): Path; | ||
toJSON(): string; | ||
equals(other: any): boolean; | ||
get length(): number; | ||
@@ -15,0 +17,0 @@ componentAt(index: number): PathComponent; |
@@ -18,2 +18,8 @@ const identifierPattern = /^[a-zA-Z_][a-zA-Z0-9_]*$/; | ||
} | ||
child(key) { | ||
if (typeof key === 'number') { | ||
return this.index(key); | ||
} | ||
return this.property(key); | ||
} | ||
connectTo(newRootPath) { | ||
@@ -35,2 +41,16 @@ return new Path(newRootPath.path.concat(this.path)); | ||
} | ||
equals(other) { | ||
if (other instanceof Path) { | ||
const otherLength = other.length; | ||
if (otherLength === this.length) { | ||
for (let i = 0; i < otherLength; i++) { | ||
if (other.componentAt(i) != this.componentAt(i)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
get length() { | ||
@@ -37,0 +57,0 @@ return this.path.length; |
{ | ||
"name": "@finnair/path", | ||
"version": "7.2.0", | ||
"version": "7.3.0", | ||
"private": false, | ||
@@ -41,3 +41,3 @@ "description": "Simple object path as array of strings and numbers", | ||
}, | ||
"gitHead": "1e0376fb19307f3b0c1b6fb483814f99d73b3302" | ||
"gitHead": "ea75162afc982ab328739838de9d94dea02a2fcf" | ||
} |
Sorry, the diff of this file is not supported yet
100829
1413