nice-path 3.0.0 → 3.1.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/.node-version +1 -1
- package/.npm-version +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +25 -0
- package/package.json +5 -5
package/.node-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
v24.3.0
|
package/.npm-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
11.4.2
|
package/dist/index.d.ts
CHANGED
|
@@ -179,4 +179,16 @@ export declare class Path {
|
|
|
179
179
|
* @param replacement - The new final segment(s) for the returned Path
|
|
180
180
|
*/
|
|
181
181
|
replaceLast(replacement: string | Path | Array<string | Path>): Path;
|
|
182
|
+
/**
|
|
183
|
+
* Return a boolean indicating whether this Path has the same separator and
|
|
184
|
+
* segments as another Path.
|
|
185
|
+
*
|
|
186
|
+
* To check only segments and not separator, use {@link Path.prototype.hasEqualSegments}.
|
|
187
|
+
*/
|
|
188
|
+
equals(other: string | Path | Array<string | Path>): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Return a boolean indicating whether this Path has the same segments as
|
|
191
|
+
* another Path. **Separator is not checked; use {@link Path.prototype.equals} for that.**
|
|
192
|
+
*/
|
|
193
|
+
hasEqualSegments(other: string | Path | Array<string | Path>): boolean;
|
|
182
194
|
}
|
package/dist/index.js
CHANGED
|
@@ -389,5 +389,30 @@ class Path {
|
|
|
389
389
|
segments.push(...replacement.segments);
|
|
390
390
|
return Path.from(segments, this.separator);
|
|
391
391
|
}
|
|
392
|
+
/**
|
|
393
|
+
* Return a boolean indicating whether this Path has the same separator and
|
|
394
|
+
* segments as another Path.
|
|
395
|
+
*
|
|
396
|
+
* To check only segments and not separator, use {@link Path.prototype.hasEqualSegments}.
|
|
397
|
+
*/
|
|
398
|
+
equals(other) {
|
|
399
|
+
if (!(other instanceof Path)) {
|
|
400
|
+
other = new Path(other);
|
|
401
|
+
}
|
|
402
|
+
return other.separator === this.separator && this.hasEqualSegments(other);
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Return a boolean indicating whether this Path has the same segments as
|
|
406
|
+
* another Path. **Separator is not checked; use {@link Path.prototype.equals} for that.**
|
|
407
|
+
*/
|
|
408
|
+
hasEqualSegments(other) {
|
|
409
|
+
if (!(other instanceof Path)) {
|
|
410
|
+
other = new Path(other);
|
|
411
|
+
}
|
|
412
|
+
return (this.segments.length === other.segments.length &&
|
|
413
|
+
this.segments.every((segment, index) => {
|
|
414
|
+
return segment === other.segments[index];
|
|
415
|
+
}));
|
|
416
|
+
}
|
|
392
417
|
}
|
|
393
418
|
exports.Path = Path;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nice-path",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": {
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"file"
|
|
18
18
|
],
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@types/node": "^
|
|
21
|
-
"prettier": "^3.
|
|
22
|
-
"typescript": "^5.
|
|
23
|
-
"vitest": "^
|
|
20
|
+
"@types/node": "^24.0.11",
|
|
21
|
+
"prettier": "^3.6.2",
|
|
22
|
+
"typescript": "^5.8.3",
|
|
23
|
+
"vitest": "^3.2.4"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "rm -rf dist && tsc",
|