Skip to content

Browserify transform that comment assert statements out of your code.

License

Notifications You must be signed in to change notification settings

node-opcua/deassertify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deassertify

Browserify transform to comment assert statements out of your code.

For example.js:

function foo(a) {
  assert(a >= 0, " expecting a positive number");
  return Math.sqrt(a);
}

then on the command line:

 browserify -t deassertify example.js > bundle.js

You can also pass in the argument nobundle to prevent the assert package from being added to your bundle.

 browserify -t [deassertify --nobundle] example.js > bundle.js

or with the api:

var browserify = require("browserify")
 , fs = require("fs")

var b = browserify("example.js")
b.transform("deassertify")

b.bundle().pipe(fs.createWriteStream("bundle.js"))

the bundle file output is:

function foo(a) {
  //-- assert(a >= 0, " expecting a positive number");
  return Math.sqrt(a);
}

Licence: MIT

About

Browserify transform that comment assert statements out of your code.

Resources

License

Stars

Watchers

Forks

Packages

No packages published