Files
test-repo/scripts/build/shims/path.js
T
fisker Cheung e2e534df30 Remove normalize-path package (#7465)
* Remove `normalize-path` module

* Try run all tests on `standalone`

* Restore test

* Add `no-parser-tests`

* Fix issue with shim

* DRY

* Rename tests

* Use `endsWith`
2020-02-03 01:33:19 +02:00

17 lines
323 B
JavaScript

const sep = /[\\/]/;
export function extname(path) {
const filename = basename(path);
const dotIndex = filename.lastIndexOf(".");
if (dotIndex === -1) return "";
return filename.slice(dotIndex);
}
export function basename(path) {
return path.split(sep).pop();
}
export function isAbsolute() {
return true;
}