error-if

0.3.0 • Public • Published

error-if is a simple assertion package.

Why? Why another JavaScript assertion package in this cruel world?

  • It's justs simple functions, no gnarly DSL or javascript property magic
  • Written in ES5, so it runs on any old browser or code without transpilation. Debugging tools should be runnable anywhere.
  • Single .js file, no dependencies, all in one singleton generator. So you can package it however you like, or even copy it into the bottom of another file
var errorIf = require("error-if")

errorIf.regexNotFound(
  "booboo",
  /boob/)

// won't throw an error because the string is in there

errorIf.notOnEnoughLines(
  "boo\nboo\nfroo\nglue\n",
  /boo/,
  3)

// will error out because the string is only found on two of the four lines.

Repackaging

It's packaged for https://www.npmjs.com/package/module-library but only for convenience. You can copy the singleton generator out and package it however you like.

Readme

Keywords

none

Package Sidebar

Install

npm i error-if

Weekly Downloads

1

Version

0.3.0

License

none

Unpacked Size

2.47 kB

Total Files

3

Last publish

Collaborators

  • erikpukinskis