mirror of https://github.com/sgoudham/carbon.git
use react-addons-shallow-compare for comparing state
parent
2e945fc528
commit
6fc3d2b5e1
@ -1,25 +0,0 @@
|
||||
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
|
||||
}
|
Loading…
Reference in New Issue