GitHub - unassert-js/unassert-cli: CLI for unassert: encourage reliable programming by writing assertions in production code, and compiling them away from release
Skip to content

CLI for unassert: encourage reliable programming by writing assertions in production code, and compiling them away from release

License

Notifications You must be signed in to change notification settings

unassert-js/unassert-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unassert-cli

CLI for unassert. Provides unassert command which compiles assertions away from target file.

unassert

Build Status NPM version Code Style License

RELATED MODULES

CHANGELOG

See CHANGELOG

EXAMPLE

For given math.js below,

'use strict';

const assert = require('node:assert/strict');

function add (a, b) {
    console.assert(typeof a === 'number');
    assert(!isNaN(a));
    assert.equal(typeof b, 'number');
    assert.ok(!isNaN(b));
    return a + b;
}

Install unassert command, run it and redirect its output into file.

$ npm install -g unassert-cli
$ unassert /path/to/src/math.js > /path/to/dist/math.js

Then you will see assert calls in /path/to/dist/math.js disappear.

'use strict';
function add(a, b) {
    return a + b;
}

See unassert project for more documentation.

INSTALL

via npm

Install globally,

$ npm install -g unassert-cli

and/or locally.

$ npm install --save-dev unassert-cli

USAGE

$ unassert /path/to/src/target.js > /path/to/build/target.js
$ cat /path/to/src/target.js | unassert > /path/to/build/target.js

OUR SUPPORT POLICY

We support Node under maintenance. In other words, we stop supporting old Node version when their maintenance ends.

This means that any other environment is not supported.

NOTE: If unassert-cli works in any of the unsupported environments, it is purely coincidental and has no bearing on future compatibility. Use at your own risk.

AUTHOR

LICENSE

Licensed under the MIT license.

About

CLI for unassert: encourage reliable programming by writing assertions in production code, and compiling them away from release

Resources

License

Stars

Watchers

Forks

Packages

No packages published