JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18392
  • Score
    100M100P100Q143403F

Assertions for library authors.

Package Exports

  • @brillout/libassert

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 (@brillout/libassert) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Minimalistic & simple assertions for library authors.

For example:

import { assertUsage, setProjectInfo } from @brillout/libassert;

export { hello };

setProjectInfo({
  projectName: 'Awesome Library',
});

function hello(name) {
  assertUsage(name, "Missing argument `name`.");
}

If your user calls hello() without arguments then assertUsage throws following error:

Error: [Awesome Library][Wrong Usage] Missing argument `name`.
    at main (/home/your-user/app/index.js:249:1)

Check the (small) source code for more information.