Function assert

  • Same as Node.js assert. If the value is falsy, throws an error, does nothing otherwise.

    Throws

    AssertionError If value is falsy.

    Parameters

    • value: any

      The test that should be truthy to pass.

    • message: string | Error = 'Assertion failed.'

      Message to be passed to AssertionError or an Error instance to throw.

    • ErrorWrapper: AssertionErrorConstructor = AssertionError

      The error class to throw if the assertion fails. Defaults to AssertionError. If a custom error class is provided for the message argument, this argument is ignored.

    Returns asserts value