Release 0.0.2
This commit is contained in:
@@ -12,9 +12,10 @@ export function normalizePath(path) {
|
||||
.replace(/^[./]+/, "")
|
||||
.replace(/^\/+/, "")
|
||||
.replace(/\/{2,}/g, "/")
|
||||
.trim();
|
||||
.trim()
|
||||
.normalize("NFC");
|
||||
try {
|
||||
return decodeURI(normalized);
|
||||
return decodeURI(normalized).normalize("NFC");
|
||||
} catch {
|
||||
return normalized;
|
||||
}
|
||||
@@ -48,6 +49,15 @@ export function parseStoragePath(rawValue) {
|
||||
};
|
||||
}
|
||||
|
||||
export function hasWildcard(path) {
|
||||
return /[*?[\]{}]/.test(String(path ?? ""));
|
||||
}
|
||||
|
||||
export function createCanonicalLocator(storage, path) {
|
||||
const cleanPath = normalizePath(path);
|
||||
return `${storage}:${cleanPath}`.normalize("NFC");
|
||||
}
|
||||
|
||||
export function getExtension(path) {
|
||||
const clean = normalizePath(path);
|
||||
const index = clean.lastIndexOf(".");
|
||||
@@ -115,6 +125,6 @@ export function createFileLocator(storage, path) {
|
||||
return {
|
||||
storage,
|
||||
path: cleanPath,
|
||||
locator: `${storage}:${cleanPath}`
|
||||
locator: createCanonicalLocator(storage, cleanPath)
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user