merlin komo

Results 3 comments of merlin komo

~~~js function get(obj, oriPath, defaultVal) { const paths = oriPath.split("."); const keys = []; for (const path of paths) { keys.push(...pathHandler(path)); } let res = obj; for (const key of...

数组存key + map ~~~js class LRUCache { _stack = []; _map = {}; constructor(len = 10) { this._len = len; } put(key, value) { if (this._stack.includes(key)) { this.update(key, value); return;...

~~~js function deepClone(target, map = new WeakMap()) { if (typeof target !== "object") return target; if (map.has(target)) return map.get(target); // 解决循环引用问题 const res = Array.isArray(target) ? [] : {}; map.set(target,...