- Updated all component headers and documentation
- Changed navbar and footer branding
- Updated homepage hero badge
- Modified page title in index.html
- Simplified footer text to 'Built with ❤️'
- Consistent V2 capitalization across all references
32 lines
843 B
JavaScript
32 lines
843 B
JavaScript
function get(obj, path, fallback, index) {
|
|
const key = typeof path === "string" ? path.split(".") : [path];
|
|
for (index = 0; index < key.length; index += 1) {
|
|
if (!obj)
|
|
break;
|
|
obj = obj[key[index]];
|
|
}
|
|
return obj === void 0 ? fallback : obj;
|
|
}
|
|
const memoize = (fn) => {
|
|
const cache = /* @__PURE__ */ new WeakMap();
|
|
const memoizedFn = (obj, path, fallback, index) => {
|
|
if (typeof obj === "undefined") {
|
|
return fn(obj, path, fallback);
|
|
}
|
|
if (!cache.has(obj)) {
|
|
cache.set(obj, /* @__PURE__ */ new Map());
|
|
}
|
|
const map = cache.get(obj);
|
|
if (map.has(path)) {
|
|
return map.get(path);
|
|
}
|
|
const value = fn(obj, path, fallback, index);
|
|
map.set(path, value);
|
|
return value;
|
|
};
|
|
return memoizedFn;
|
|
};
|
|
const memoizedGet = memoize(get);
|
|
|
|
export { get, memoize, memoizedGet };
|