Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'nan',
'nil',
'number',
'promise',
'string',
'symbol',
'undef',
'weakmap',
'weakset',
];
const newObject = copy(object);
console.log(object, newObject);
console.log('is equal object', sameValueZeroEqual(object, newObject));
console.log('is shallowEqual object', shallowEqual(object, newObject));
console.log('is deepEqual object', deepEqual(object, newObject));
console.log('lodash copy', _.cloneDeep(object));
console.log('clone copy', clone(object));
console.log('deepclone copy', deepClone(object));
Object.keys(object).forEach((key) => {
console.group(key);
console.log(`new object has key ${key}`, Object.prototype.hasOwnProperty.call(newObject, key));
if (~primitiveKeys.indexOf(key)) {
console.log(`is ${key} equal`, sameValueZeroEqual(object[key], newObject[key]));
} else {
console.log(`is ${key} not equal`, !sameValueZeroEqual(object[key], newObject[key]));
console.log(`is ${key} equivalent`, deepEqual(object[key], newObject[key]));
Object.keys(object).forEach((key) => {
console.group(key);
console.log(`new object has key ${key}`, Object.prototype.hasOwnProperty.call(newObject, key));
if (~primitiveKeys.indexOf(key)) {
console.log(`is ${key} equal`, sameValueZeroEqual(object[key], newObject[key]));
} else {
console.log(`is ${key} not equal`, !sameValueZeroEqual(object[key], newObject[key]));
console.log(`is ${key} equivalent`, deepEqual(object[key], newObject[key]));
console.log(
`is prototype of ${key} equal`,
sameValueZeroEqual(Object.getPrototypeOf(object[key]), Object.getPrototypeOf(newObject[key]))
);
}
console.log('can copy deeply', isObjectCopyable(object[key], {has: () => false}));
console.log(`copy of ${key} type`, copy(object[key]));
console.groupEnd(key);
});
Object.keys(object).forEach((key) => {
console.group(key);
console.log(`new object has key ${key}`, Object.prototype.hasOwnProperty.call(newObject, key));
if (~primitiveKeys.indexOf(key)) {
console.log(`is ${key} equal`, sameValueZeroEqual(object[key], newObject[key]));
} else {
console.log(`is ${key} not equal`, !sameValueZeroEqual(object[key], newObject[key]));
console.log(`is ${key} equivalent`, deepEqual(object[key], newObject[key]));
console.log(
`is prototype of ${key} equal`,
sameValueZeroEqual(Object.getPrototypeOf(object[key]), Object.getPrototypeOf(newObject[key]))
);
}
console.log('can copy deeply', isObjectCopyable(object[key], {has: () => false}));
console.log(`copy of ${key} type`, copy(object[key]));
console.groupEnd(key);
});
Object.keys(object).forEach((key) => {
console.group(key);
console.log(`new object has key ${key}`, Object.prototype.hasOwnProperty.call(newObject, key));
if (~primitiveKeys.indexOf(key)) {
console.log(`is ${key} equal`, sameValueZeroEqual(object[key], newObject[key]));
} else {
console.log(`is ${key} not equal`, !sameValueZeroEqual(object[key], newObject[key]));
console.log(`is ${key} equivalent`, deepEqual(object[key], newObject[key]));
console.log(
`is prototype of ${key} equal`,
sameValueZeroEqual(Object.getPrototypeOf(object[key]), Object.getPrototypeOf(newObject[key]))
);
}
console.log('can copy deeply', isObjectCopyable(object[key], {has: () => false}));
console.log(`copy of ${key} type`, copy(object[key]));
console.groupEnd(key);
});