https://github.com/node-opcua/deassertify
Browserify transform that comment assert statements out of your code.
https://github.com/node-opcua/deassertify
Last synced: 12 months ago
JSON representation
Browserify transform that comment assert statements out of your code.
- Host: GitHub
- URL: https://github.com/node-opcua/deassertify
- Owner: node-opcua
- License: mit
- Created: 2015-06-24T21:35:51.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-06-25T10:11:00.000Z (over 3 years ago)
- Last Synced: 2024-04-14T00:58:29.279Z (almost 2 years ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Deassertify
Browserify transform to comment assert statements out of your code.
For example.js:
```javascript
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:
```javascript
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:
```javascript
function foo(a) {
//-- assert(a >= 0, " expecting a positive number");
return Math.sqrt(a);
}
```
Licence: MIT