a
function createShallowMemoSelector(selector) {
let cacheI;
let cacheIKeys;
let cacheO;
return (input) => {
if (!cacheI) {
cacheIKeys = Object.keys((cacheI = input));
return (cacheO = selector(input));
}
const iKeys = Object.keys(input);
if (
cacheIKeys.length === iKeys.length &&
iKeys.every((k) => Object.is(input[k], cacheI[k]))
) {
return cacheO;
}
cacheI = input;
cacheIKeys = iKeys;
return (cacheO = selector(input));
};
}