@bscotch/pathy
Advanced tools
Comparing version 0.3.1 to 0.4.0
import { __decorate, __metadata } from "tslib"; | ||
import { stringIsMatch } from '@bscotch/utility'; | ||
import { arrayIsDuplicates, stringIsMatch } from '@bscotch/utility'; | ||
import { ok } from 'assert'; | ||
@@ -202,3 +202,16 @@ import fse from 'fs-extra'; | ||
static equals(firstPath, otherPath) { | ||
return (PathyStatic.normalize(firstPath) === PathyStatic.normalize(otherPath)); | ||
// If one path has a cwd and the other does | ||
// not, assume the same cwd for the other | ||
const cwds = [firstPath, otherPath] | ||
.map((p) => (typeof p === 'string' ? undefined : p.workingDirectory)) | ||
.filter((x) => x); | ||
const cwd = arrayIsDuplicates(cwds) && cwds[0]; | ||
const normalized = [firstPath, otherPath].map((p) => { | ||
p = PathyStatic.normalize(p); | ||
if (cwd) { | ||
p = PathyStatic.resolve(cwd, p); | ||
} | ||
return p; | ||
}); | ||
return normalized[0] === normalized[1]; | ||
} | ||
@@ -373,3 +386,3 @@ /** | ||
} | ||
fse.ensureDir(nodePath.dirname(filepath)); | ||
await fse.ensureDir(nodePath.dirname(filepath)); | ||
let serialized; | ||
@@ -376,0 +389,0 @@ if (typeof options?.serialize == 'function') { |
{ | ||
"name": "@bscotch/pathy", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"type": "module", | ||
@@ -19,3 +19,3 @@ "exports": { | ||
"dependencies": { | ||
"@bscotch/utility": "^5.0.0", | ||
"@bscotch/utility": "^5.1.0", | ||
"chai": "^4.3.6", | ||
@@ -22,0 +22,0 @@ "fs-extra": "^10.1.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
88931
1582
Updated@bscotch/utility@^5.1.0