[css] requests update

This commit is contained in:
Martin Aeschlimann
2020-06-08 13:40:26 +02:00
parent cbb1610c12
commit b49d4cf5e6
2 changed files with 27 additions and 2 deletions

View File

@@ -113,9 +113,26 @@ export function basename(uri: string) {
return uri.substr(lastIndexOfSlash + 1);
}
const Slash = '/'.charCodeAt(0);
const Dot = '.'.charCodeAt(0);
export function extname(uri: string) {
for (let i = uri.length - 1; i >= 0; i--) {
const ch = uri.charCodeAt(i);
if (ch === Dot) {
if (i > 0 && uri.charCodeAt(i - 1) !== Slash) {
return uri.substr(i);
} else {
break;
}
} else if (ch === Slash) {
break;
}
}
return '';
}
export function isAbsolutePath(path: string) {
return path.charCodeAt(0) === Slash;
}