debug

Asserts given conditions.

Type signature

(
  condition: boolean,
  callbackOrMessage:
    | {
        (): void;
      }
    | string
) => void

Examples

assert(true === false);
// ⇒ TypeError("Assertion failed!")
Try in REPL

Questions

  • How to assert a condition?
  • How to throw when a condition is not satisfied?

TypeScript sourceJavaScript source

Computes a deep difference between the two values (primitives, objects, arrays, etc.).

Type signature

(
  obj1?: {
    [index: string]: any;
  },
  obj2?: {
    [index: string]: any;
  }
) => object

Examples

diff({ a: 1 }, { a: 2 });
// ⇒ { a: { data: [1, 2], type: '~' }}
Try in REPL

Questions

  • How to compute a diff?
  • How to compute a deep diff?
  • How to compute a diff between two objects?
  • How to compute a diff between two arrays?

TypeScript sourceJavaScript source