empower-assert
Convert assert to power-assert on ESTree AST
Last updated 7 years ago by teppeis .
MIT · Repository · Bugs · Original npm
$ cnpm install empower-assert 
SYNC missed versions from official npm registry.

empower-assert

Convert assert to power-assert on ESTree AST.

NPM version Node.js version support build status Dependency Status MIT License

Install

$ npm install --save-dev empower-assert

Usage

const empowerAssert = require('empower-assert');
const acorn = require('acorn');
const escodegen = require('escodegen');

let source = 
`'use strict';
const assert = require('assert');
function add(a, b) {
    assert(!isNaN(a));
    assert.equal(typeof b, 'number');
    assert.ok(!isNaN(b));
    return a + b;
}`;

let transformed = empowerAssert(acorn.parse(source));
console.log(escodegen.generate(transformed));
// 'use strict';
// const assert = require('power-assert');
// function add(a, b) {
//     assert(!isNaN(a));
//     assert.equal(typeof b, 'number');
//     assert.ok(!isNaN(b));
//     return a + b;
// }

License

MIT License: Teppei Sato <teppeis@gmail.com>

This is a port of babel-plugin-empower-assert.
Copyright (c) 2016 Takuto Wada, https://github.com/power-assert-js/babel-plugin-empower-assert

Current Tags

  • 1.1.0                                ...           latest (7 years ago)

1 Versions

  • 1.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (5)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org