Files
url_tracker_tool/node_modules/@chakra-ui/styled-system/dist/esm/get.mjs
Andrei 58f8093689 Rebrand from 'Redirect Intelligence v2' to 'URL Tracker Tool V2' throughout UI
- 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
2025-08-19 19:12:23 +00:00

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 };