How to use the @igo2/utils.ObjectUtils.objectsAreEquivalent function in @igo2/utils

To help you get started, we’ve selected a few @igo2/utils 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 infra-geo-ouverte / igo2-lib / packages / common / src / lib / entity / shared / watcher.ts View on Github external
let changesDetected = false;
    const storeIndex = this.store.state.index;
    const innerIndex = this.innerStateIndex;

    if (storeIndex.size !== innerIndex.size) {
      changesDetected = this.detectChanges();
    }

    const storeKeys = Array.from(storeIndex.keys());
    for (const key of storeKeys) {
      const storeValue = storeIndex.get(key);
      const innerValue = innerIndex.get(key);
      if (changesDetected === false) {
        if (innerValue === undefined) {
          changesDetected = this.detectChanges();
        } else if (!ObjectUtils.objectsAreEquivalent(storeValue, innerValue)) {
          changesDetected = this.detectChanges();
        }
      }

      this.innerStateIndex.set(key, Object.assign({}, storeValue));
    }
  }