thing-assert

1.1.0 • Public • Published

thing-assert

GitHub license npm version Build Status codecov PRs Welcome Known Vulnerabilities npm download

Description

Nodejs's assert error has no status code. Through thing-assert you can define your own error status and capture from the thrown out error object.

Install

$ npm i thing-assert

Usage

const thingAssert = require('thing-assert')
 
try {
  thingAssert(false, 'error message', 400)
} catch (error) {
  console.log(error.status) // output 400
}

Questions & Suggestions

Please open an issue here.

License

MIT

Dependents (1)

Package Sidebar

Install

npm i thing-assert

Weekly Downloads

2

Version

1.1.0

License

MIT

Unpacked Size

8.91 kB

Total Files

11

Last publish

Collaborators

  • jsonma