How to use the fast-equals.circularDeepEqual 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 cartant / rxjs-marbles / source / matcher.ts View on Github external
export function observableMatcher(
  actual: any,
  expected: any,
  assert: any,
  assertDeepEqual: any,
  frameworkMatcher: any
): any {
  if (Array.isArray(actual) && Array.isArray(expected)) {
    actual = actual.map(deleteErrorNotificationStack);
    expected = expected.map(deleteErrorNotificationStack);

    if (frameworkMatcher) {
      assertDeepEqual(actual, expected);
    } else {
      const passed = circularDeepEqual(actual, expected);
      if (passed) {
        assert(true, "");
        return;
      }

      let message = "\nExpected \n";
      actual.forEach((x: any) => (message += `\t${stringify(x)}\n`));

      message += "\t\nto deep equal \n";
      expected.forEach((x: any) => (message += `\t${stringify(x)}\n`));

      assert(passed, message);
    }
  } else {
    assertDeepEqual(actual, expected);
  }
github cartant / rxjs-marbles / source / configuration.ts View on Github external
function defaultAssertDeepEqual(a: any, b: any): void {
  if (circularDeepEqual(a, b)) {
    return;
  }
  throw new Error(`Expected ${toString(a)} to equal ${toString(b)}.`);
}

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