mirror of https://github.com/sgoudham/carbon.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
470 B
JavaScript
26 lines
470 B
JavaScript
export default function shallowEquals (a, b) {
|
|
for (const i in a) {
|
|
// NaN === NaN is false in Javascript
|
|
if(isNaN(b[i]) && isNaN(a[i])) {
|
|
continue
|
|
}
|
|
if (b[i] !== a[i]) {
|
|
console.log('DID NOT MATCH', i, a[i], b[i])
|
|
return false
|
|
}
|
|
}
|
|
|
|
for (const i in b) {
|
|
// NaN === NaN is false in Javascript
|
|
if(isNaN(b[i]) && isNaN(a[i])) {
|
|
continue
|
|
}
|
|
|
|
if (b[i] !== a[i]) {
|
|
return false
|
|
}
|
|
}
|
|
|
|
return true
|
|
}
|