@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
38 lines • 1.26 kB
JavaScript
export class CaseInsensitiveStringMap {
constructor(map) {
if (map && typeof map === "object") {
Object.assign(this, Object.keys(map).reduce((obj, key) => {
obj[key.toLowerCase()] = map[key];
return obj;
}, {}));
}
return new Proxy(this, {
set: (obj, prop, value) => {
if (typeof prop === "string") {
return Reflect.set(obj, prop.toLowerCase(), value);
}
else {
return Reflect.set(obj, prop, value);
}
},
get: (obj, prop) => {
if (typeof prop === "string") {
return Reflect.get(obj, prop.toLowerCase());
}
else {
return Reflect.get(obj, prop);
}
},
has: (obj, prop) => {
if (typeof prop === "string") {
return Reflect.has(obj, prop.toLowerCase());
}
return Reflect.has(obj, prop);
},
ownKeys(obj) {
return Reflect.ownKeys(obj);
},
});
}
}
//# sourceMappingURL=base-types.js.map