Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4759.js (118.4 MB)
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
// Module ID: 1584
|
|
// Function ID: 1585
|
|
// Dependencies: [19]
|
|
// Exports: useMemoArray
|
|
|
|
// Module 1584
|
|
import noop from "module_19" /* 19 */;
|
|
|
|
|
|
export const useMemoArray = function useMemoArray(arr) {
|
|
const ref = noop.useRef(undefined);
|
|
const current = ref.current;
|
|
const mapped = arr.map((item, index) => {
|
|
[tmp, arr] = item;
|
|
let tmp3;
|
|
if (current != null) {
|
|
tmp3 = tmp2.entries[index];
|
|
}
|
|
let everyResult = tmp3;
|
|
if (tmp3) {
|
|
everyResult = tmp3.deps.length === arr.length;
|
|
}
|
|
if (everyResult) {
|
|
const deps = tmp3.deps;
|
|
everyResult = deps.every((item, index) => Object.is(item, current[index]));
|
|
}
|
|
if (!everyResult) {
|
|
const obj = { item: tmp, deps: arr };
|
|
tmp3 = obj;
|
|
}
|
|
return tmp3;
|
|
});
|
|
if (current) {
|
|
if (current.entries.length === mapped.length) {
|
|
if (mapped.every((item, index) => item === current.entries[index])) {
|
|
return current.items;
|
|
}
|
|
}
|
|
}
|
|
const mapped1 = mapped.map((item) => item.item);
|
|
ref.current = { entries: mapped, items: mapped1 };
|
|
return mapped1;
|
|
};
|