@nevware21/tripwire - v0.1.2
    Preparing search index...

    Function addAssertFunc

    • Adds a new assertion function to the Assert "class" (function).

      Parameters

      • target: any
      • name: string

        The name of the function to add.

      • fnDef: AssertClassDef

        The definition of the function to add, this can be a string (is.object), an array of strings (["is", "obejct"]) which identify the sequence of operations to perform or a IScopeFn function, or an IAssertClassDef object.

      • OptionalresponseHandler: (result: any) => any

      Returns void

      AssertionError - If the definition is invalid.

      addAssertFunc("isPositive", (value) => this._context.eval(value > 0, "Expected a positive number"));

      assert.isPositive(1); // Passes
      assert.isPositive(0); // Fails - throws an AssertionFailure

      0.1.0