How to use the fast-equals.shallowEqual 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 / react-local-redux / src / connectLocal.js View on Github external
props,
      state,
    } = instance;

    if (typeof actionCreators === 'function' && (!pure || !areOwnPropsEqual(props, nextProps))) {
      instance.actionCreators = getActionCreators(actionCreators, __store.dispatch, nextProps);
    }

    if (!pure) {
      return true;
    }

    return (
      !areOwnPropsEqual(props, nextProps)
      || !areStatesEqual(state, nextState)
      || !shallowEqual(context, nextContext)
      || !areMergedPropsEqual(
        // eslint workaround
        mergeProps(state, wrappedActionCreators, props),
        mergeProps(nextState, instance.actionCreators, nextProps)
      )
    );
  };
github planttheidea / fast-copy / DEV_ONLY / App.js View on Github external
'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]));
    console.log(
github typewriter-editor / typewriter / src / html-view.js View on Github external
updateEditorSelection() {
    if (this._settingBrowserSelection) return this._settingBrowserSelection = false;
    const range = getSelection(this);
    this._settingEditorSelection = true;
    this.editor.setSelection(range);
    this._settingEditorSelection = false;
    if (!shallowEqual(range, this.editor.selection)) this.updateBrowserSelection();
  }

fast-equals

A blazing fast equality comparison, either shallow or deep

MIT
Latest version published 1 year ago

Package Health Score

73 / 100
Full package analysis