lodash#IsEqualCustomizer TypeScript Examples

The following examples show how to use lodash#IsEqualCustomizer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: diff.service.ts    From amplication with Apache License 2.0 6 votes vote down vote up
/**
   *  Creates an equality comparison customizer function.
   *  The returned function will :
   *  - Consider values equal (return true) if their key is in ignoredProperties (it won't compare them)
   *  - Tell the isEqualWith function to compare them by returning undefined
   * @param ignoredProperties An array of properties we don't want to compare
   * @returns An equality comparison customizer function
   */
  private createIgnorePropertiesisEqualCustomizer(
    ignoredProperties: string[]
  ): IsEqualCustomizer {
    return (value, other, indexOrKey) =>
      (typeof indexOrKey === 'string' &&
        ignoredProperties.includes(indexOrKey)) ||
      undefined;
  }