You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
530 B
22 lines
530 B
// @flow
|
|
|
|
export default function areInputsEqual(
|
|
newInputs: mixed[],
|
|
lastInputs: mixed[],
|
|
) {
|
|
// 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++) {
|
|
// using shallow equality check
|
|
if (newInputs[i] !== lastInputs[i]) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|