@sync-in/server
Version:
The secure, open-source platform for file storage, sharing, collaboration, and sync
52 lines (51 loc) • 1.5 kB
JavaScript
/*
* Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>
* This file is part of Sync-in | The open source file sync and share solution
* See the LICENSE file for licensing details
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "NormalizedMap", {
enumerable: true,
get: function() {
return NormalizedMap;
}
});
let NormalizedMap = class NormalizedMap extends Map {
normalizeKey(key) {
return key.normalize('NFC');
}
set(key, value) {
this.index.set(this.normalizeKey(key), key); // store the "real" key used
return super.set(key, value);
}
getResolvedKey(input) {
return this.index.get(this.normalizeKey(input));
}
get(key) {
const resolved = this.getResolvedKey(key);
return resolved ? super.get(resolved) : undefined;
}
has(key) {
return this.index.has(this.normalizeKey(key));
}
delete(key) {
const resolved = this.getResolvedKey(key);
if (resolved) {
this.index.delete(this.normalizeKey(resolved));
return super.delete(resolved);
}
return false;
}
constructor(entries){
super(), // NFC-normalized path → actual key
this.index = new Map();
if (entries) {
for (const [k, v] of entries){
this.set(k, v);
}
}
}
};
//# sourceMappingURL=normalizedMap.js.map