How to use the fast-equals.sameValueZeroEqual function in fast-equals

To help you get started, we’ve selected a few fast-equals examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github planttheidea / fast-copy / DEV_ONLY / App.js View on Github external
'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]));
github planttheidea / fast-copy / DEV_ONLY / App.js View on Github external
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);
});
github planttheidea / fast-copy / DEV_ONLY / App.js View on Github external
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);
});
github planttheidea / fast-copy / DEV_ONLY / App.js View on Github external
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);
});

fast-equals

A blazing fast equality comparison, either shallow or deep

MIT
Latest version published 2 years ago

Package Health Score

67 / 100
Full package analysis