Files
klz-cables.com/.pnpm-store/v10/files/69/65309c25b02ed802fe00788ce3e05dea24201494d0a66c4b3f9bd0a265449d1c4a3d3b2a7c4d451834bb5d7aadb52cd8143e080b5d1c20b6f71ef25e5df59c
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

42 lines
1.2 KiB
Plaintext

// Number.isNaN as it is not supported in IE11 so conditionally using ponyfill
// Using Number.isNaN where possible as it is ~10% faster
const safeIsNaN =
Number.isNaN ||
function ponyfill(value: unknown): boolean {
// // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN#polyfill
// NaN is the only value in JavaScript which is not equal to itself.
return typeof value === 'number' && value !== value;
};
function isEqual(first: unknown, second: unknown): boolean {
if (first === second) {
return true;
}
// Special case for NaN (NaN !== NaN)
if (safeIsNaN(first) && safeIsNaN(second)) {
return true;
}
return false;
}
export default function areInputsEqual(
newInputs: readonly unknown[],
lastInputs: readonly unknown[],
): boolean {
// no checks needed if the inputs length has changed
if (newInputs.length !== lastInputs.length) {
return false;
}
// Using for loop for speed. It generally performs better than array.every
// https://github.com/alexreardon/memoize-one/pull/59
for (let i = 0; i < newInputs.length; i++) {
if (!isEqual(newInputs[i], lastInputs[i])) {
return false;
}
}
return true;
}