How to use deep-eql - 9 common examples

To help you get started, we’ve selected a few deep-eql 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 mozilla / addons-frontend / src / amo / pages / Collection / index.js View on Github external
}

    if (creating || loading) {
      return;
    }

    let collectionChanged = false;
    let addonsPageChanged = false;

    if (prevProps && prevProps.location && location) {
      if (prevProps.location.pathname !== location.pathname) {
        collectionChanged = true;
      }
    }

    if (prevProps && !deepEqual(prevProps.filters, filters)) {
      addonsPageChanged = true;
    }

    if (collection) {
      let isSameCollectionUser;
      // Is `userId` a numeric ID?
      if (/^\d+$/.test(params.userId)) {
        isSameCollectionUser = `${collection.authorId}` === params.userId;
      } else {
        isSameCollectionUser =
          collection.authorUsername.toLowerCase() ===
          params.userId.toLowerCase();
      }

      if (
        collection.slug.toLowerCase() !== params.slug.toLowerCase() ||
github ant-design / ant-design-landing / site / utils.jsx View on Github external
export function objectEqual(obj1, obj2) {
  if (obj1 === obj2 || deepEql(obj1, obj2)) {
    return true;
  }
  if (!obj1 || !obj2 || getEnumerableKeys(obj1).length !== getEnumerableKeys(obj2).length) {
    return false;
  }
  // animation 写在标签上的进行判断是否相等, 判断每个参数有没有 function;
  let equalBool = true;
  const setEqualBool = ($a, $b) => {
    const objA = getEnumerableKeys($a).length > getEnumerableKeys($b).length ? $a : $b;
    const objB = getEnumerableKeys($a).length > getEnumerableKeys($b).length ? $b : $a;
    getEnumerableKeys(objA).forEach((key) => {
      // 如果前面有参数匹配不相同则直接返回;
      if (!equalBool) {
        return;
      }
      if (!(key in objB)) {
github sheinsight / shineout / src / Datum / Form.js View on Github external
setValue(values = {}, type, forceSet) {
    if (!forceSet && deepEqual(values, this.$values)) return
    this.$values = deepMerge({}, values, { clone: true })

    // wait render end.
    setTimeout(() => {
      Object.keys(this.$inputNames)
        .sort((a, b) => a.length - b.length)
        .forEach(name => {
          this.dispatch(updateSubscribe(name), this.get(name), name, type)
          this.dispatch(changeSubscribe(name))
        })

      // for flow
      this.dispatch(CHANGE_TOPIC)
    })
  }
github sheinsight / shineout / src / utils / shallowEqual.js View on Github external
keysA.sort((a, b) => deep.indexOf(a) - deep.indexOf(b))

  // Test for A's keys different from B.
  for (let i = 0; i < keysA.length; i++) {
    const k = keysA[i]
    if (skip.includes(k)) continue

    if (!hasOwnProperty.call(objB, k) || !is(objA[k], objB[k])) {
      if (objA[k] instanceof Error && objB[k] instanceof Error) {
        if (objA[k].message !== objB[k].message) return false
        continue
      }

      if (deep.includes(k)) {
        if (!deepEqual(objA[k], objB[k])) return false
      } else {
        return false
      }
    }
  }

  return true
}
github withspectrum / spectrum / src / App / MiddleColumn / StoryCard / index.js View on Github external
shouldComponentUpdate = (nextProps, nextState) => {
    return (
      !deepEqual(this.props, nextProps) || !deepEqual(this.state, nextState)
    );
  };
github withspectrum / spectrum / src_old / App / RightColumn / StoryChatContainer / StoryChat / StoryActions / index.js View on Github external
shouldComponentUpdate(nextProps: Object, nextState: Object) {
    return !deepEqual(nextProps, this.props) || nextState !== this.state;
  }
github sheinsight / shineout / src / Table / index.js View on Github external
getColumns(columns) {
    if (deepEqual(columns, this.oldColumns)) {
      return this.cachedColumns
    }

    const { onRowSelect, datum } = this.props
    columns = columns.filter(c => typeof c === 'object')

    let left = -1
    let right = -1
    columns.forEach((c, i) => {
      if (c.fixed === 'left') left = i
      if (c.fixed === 'right' && right < 0) right = i
    })
    this.cachedColumns = columns.map((c, i) =>
      immer(c, draft => {
        draft.index = i
        if (draft.key === undefined) draft.key = i
github mozilla / addons-frontend / src / amo / components / AddonsByAuthorsCard / index.js View on Github external
pageParam,
      paginate,
    } = this.props;

    if (!newAuthorIds) {
      return;
    }

    const newPage = paginate
      ? oldLocation.query[pageParam] !== newLocation.query[pageParam]
      : false;

    if (
      oldAddonType !== newAddonType ||
      oldForAddonSlug !== newForAddonSlug ||
      !deepEqual(oldAuthorIds, newAuthorIds) ||
      newPage
    ) {
      this.dispatchFetchAddonsByAuthors({
        addonType: newAddonType,
        authorIds: newAuthorIds,
        forAddonSlug: newForAddonSlug,
        page: this.getCurrentPage({
          location: newLocation,
          paginate,
          pageParam,
        }),
      });
    }
  }
github withspectrum / spectrum / src_old / shared / InfiniteList / index.js View on Github external
componentWillReceiveProps = nextProps => {
    if (deepEqual(this.props, nextProps)) return;
    this.clearCache(nextProps);
  };

deep-eql

Improved deep equality testing for Node.js and the browser.

MIT
Latest version published 6 months ago

Package Health Score

79 / 100
Full package analysis

Popular deep-eql functions