JSPM

assert-lite

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q28408F
  • License MIT

Assertion groups made easy via a one-liner function call -- like using console.assert(but_drastically_improved, [ allowing, multiple, assertions, and, ()=> functions_too ] )

Package Exports

  • assert-lite
  • assert-lite/assert-lite.js

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

Readme

assert-lite.js - https://github.com/DarrenSem/assert-lite

Assertion groups made easy via a one-liner function call

Like using console.assert(but_drastically_improved, [ allowing, multiple, assertions, and, ()=> functions_too ] )

// Usage examples:

// var assert = globalThis.assert || module.exports || require("assert-lite");
// const assert = require("./assert-lite.js");  // alternative to package.json devDependencies: { "assert-lite": "file:./" }
const assert = require("assert-lite");

assert.is = (a, e) => Object.is(a, e);

const results = assert([

  () => 1,
  () => 1 == "1",
  ,

  () => 1 === "1",
  [0, "<<< zero should be truthy"],
  [
    t => t.is(null, undefined),
    "\n ^",
    null,
    "should be strictly equal to",
    undefined,
  ],
  null,
  ,

  {},

]);

if (!results.every(Boolean)) {
  console.log("results:", results);
  // (7) [1, true, false, 0, false, null, {}]
  debugger;

};

console.log("\nOut of", results.length, "tests, did correct # of them pass?");
if(results.filter(Boolean).length !== 3) {
  process.exit(1);  // how about no
};