12345678910111213141516171819202122232425262728293031 |
- function isPrimitive(obj) {
- return obj !== Object(obj);
- }
- export function isEqual(first, second) {
- if (first === second) {
- return true;
- }
- if (isPrimitive(first) || isPrimitive(second) || typeof first === 'function' || typeof second === 'function') {
- return first === second;
- }
- if (Object.keys(first).length !== Object.keys(second).length) {
- return false;
- }
- for (var _i = 0, _Object$keys = Object.keys(first); _i < _Object$keys.length; _i++) {
- var key = _Object$keys[_i];
- if (!(key in second)) {
- return false;
- }
- if (!isEqual(first[key], second[key])) {
- return false;
- }
- }
- return true;
- }
|