JSPM

nanoassert

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 492232
  • Score
    100M100P100Q167657F
  • License ISC

Nanoscale assertion module

Package Exports

  • nanoassert

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nanoassert) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

nanoassert

Nanoscale assertion module

Usage

var assert = require('nanoassert')

assert(a !== b, `${a} !== ${b}`)

API

assert(declaration, [message])

Assert that declaration is truthy otherwise throw Error with optional message, which defaults to AssertionError. If you want friendlier messages you can use template strings to show the assertion made like in the example above.

Why

I like to write public facing code very defensively, but have complaints about the size incurred by the assert module. I only use the top-level assert method anyway, so this should make everyone happy :)

Install

npm install nanoassert

License

ISC