Skip to content

Commit

Permalink
docs: add api documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Sep 9, 2018
1 parent 2433c29 commit 9eaf9c0
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,62 @@ try {
}
```

## API

The API of this module is intended to be similar to the
[Node.js `assert` module](https://nodejs.org/dist/latest/docs/api/assert.html).

Each function will throw an instance of `HttpError` from
[the `http-errors` module](https://www.npmjs.com/package/http-errors)
when the assertion fails.

### assert(value, [status], [message], [properties])

Tests if `value` is truthy. If `value` is not truthy, an `HttpError`
is thrown that is constructed with the given `status`, `message`,
and `properties`.

### assert.deepEqual(a, b, [status], [message], [properties])

Tests for deep equality between `a` and `b`. Primitive values are
compared with the Abstract Equality Comparison (`==`). If `a` and `b`
are not equal, an `HttpError` is thrown that is constructed with the
given `status`, `message`, and `properties`.

### assert.equal(a, b, [status], [message], [properties])

Tests shallow, coercive equality between `a` and `b` using the Abstract
Equality Comparison (`==`). If `a` and `b` are not equal, an `HttpError`
is thrown that is constructed with the given `status`, `message`,
and `properties`.

### assert.notDeepEqual(a, b, [status], [message], [properties])

Tests for deep equality between `a` and `b`. Primitive values are
compared with the Abstract Equality Comparison (`==`). If `a` and `b`
are equal, an `HttpError` is thrown that is constructed with the given
`status`, `message`, and `properties`.

### assert.notEqual(a, b, [status], [message], [properties])

Tests shallow, coercive equality between `a` and `b` using the Abstract
Equality Comparison (`==`). If `a` and `b` are equal, an `HttpError` is
thrown that is constructed with the given `status`, `message`, and
`properties`.

### assert.notStrictEqual(a, b, [status], [message], [properties])

Tests strict equality between `a` and `b` as determined by the SameValue
Comparison (`===`). If `a` and `b` are equal, an `HttpError` is thrown
that is constructed with the given `status`, `message`, and `properties`.

### assert.strictEqual(a, b, [status], [message], [properties])

Tests strict equality between `a` and `b` as determined by the SameValue
Comparison (`===`). If `a` and `b` are not equal, an `HttpError`
is thrown that is constructed with the given `status`, `message`,
and `properties`.

## Licence

[MIT](LICENSE)
Expand Down

0 comments on commit 9eaf9c0

Please sign in to comment.