@nodelib/fs.walk
Advanced tools
Comparing version 1.2.5 to 1.2.6
@@ -23,4 +23,10 @@ "use strict"; | ||
} | ||
/** | ||
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). | ||
*/ | ||
if (a.endsWith(separator)) { | ||
return a + b; | ||
} | ||
return a + separator + b; | ||
} | ||
exports.joinPathSegments = joinPathSegments; |
@@ -73,3 +73,14 @@ "use strict"; | ||
}); | ||
it('should return correct string when the first segment ens with the separator symbol', () => { | ||
// Unix | ||
assert.strictEqual(common.joinPathSegments('/', 'a', '/'), '/a'); | ||
assert.strictEqual(common.joinPathSegments('//', 'a', '/'), '//a'); | ||
assert.strictEqual(common.joinPathSegments('/a/', 'b', '/'), '/a/b'); | ||
// Windows | ||
assert.strictEqual(common.joinPathSegments('C:/', 'Users', '/'), 'C:/Users'); | ||
assert.strictEqual(common.joinPathSegments('C:\\', 'Users', '\\'), 'C:\\Users'); | ||
assert.strictEqual(common.joinPathSegments('//?/C:/', 'Users', '/'), '//?/C:/Users'); | ||
assert.strictEqual(common.joinPathSegments('\\\\?\\C:\\', 'Users', '\\'), '\\\\?\\C:\\Users'); | ||
}); | ||
}); | ||
}); |
{ | ||
"name": "@nodelib/fs.walk", | ||
"version": "1.2.5", | ||
"version": "1.2.6", | ||
"description": "A library for efficiently walking a directory recursively", | ||
@@ -34,3 +34,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "cb5f7e893a986164c3b847a4f1faef6c54cadd68" | ||
"gitHead": "bd149ea6dc1ef18c234730278271f6a7f3882ed2" | ||
} |
@@ -100,3 +100,16 @@ import * as assert from 'assert'; | ||
}); | ||
it('should return correct string when the first segment ens with the separator symbol', () => { | ||
// Unix | ||
assert.strictEqual(common.joinPathSegments('/', 'a', '/'), '/a'); | ||
assert.strictEqual(common.joinPathSegments('//', 'a', '/'), '//a'); | ||
assert.strictEqual(common.joinPathSegments('/a/', 'b', '/'), '/a/b'); | ||
// Windows | ||
assert.strictEqual(common.joinPathSegments('C:/', 'Users', '/'), 'C:/Users'); | ||
assert.strictEqual(common.joinPathSegments('C:\\', 'Users', '\\'), 'C:\\Users'); | ||
assert.strictEqual(common.joinPathSegments('//?/C:/', 'Users', '/'), '//?/C:/Users'); | ||
assert.strictEqual(common.joinPathSegments('\\\\?\\C:\\', 'Users', '\\'), '\\\\?\\C:\\Users'); | ||
}); | ||
}); | ||
}); |
@@ -25,3 +25,10 @@ import Settings, { FilterFunction } from '../settings'; | ||
/** | ||
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). | ||
*/ | ||
if (a.endsWith(separator)) { | ||
return a + b; | ||
} | ||
return a + separator + b; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
209514
2186
0