1.1.0 • Published 8 years ago

udebug v1.1.0

Weekly downloads
11
License
MIT
Repository
github
Last release
8 years ago

udebug

travis-ci npm-version

Remove visionmedia/debug related code using AST.

Install

npm install udebug

CLI

udebug src.js

will print results to stdout, or output to the file with -o option:

udebug src.js -o dist.js

and you can pass -d option to enable source map.

Stdin is also available:

echo 'var debug = require("debug")' | udebug

API

var udebug = require('udebug')

udebug(code, opts)

Remove visionmedia/debug related code from code using AST.

Example

var udebug = require('udebug')

var code = [
  'var debug = require("debug"),',
  '    d     = debug("MYAPP")   ',
  '                             ',
  'function greet() {           ',
  '  d("#greet called")         ',
  '  return "hi"                ',
  '}                            '
].join('\n')

process.stdout.write(udebug(code, {filepath: 'a.js', debug: true}))

will output:

function greet() {
    return 'hi';
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImEuanMiXSwibmFtZXMiOlsiZ3JlZXQiXSwibWFwcGluZ3MiOiJBQUdBLFNBQVNBLEtBQVQsR0FBaUI7QUFBQSxJQUVmLE9BQU8sSUFBUCxDQUZlO0FBQUEiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZGVidWcgPSByZXF1aXJlKFwiZGVidWdcIiksXG4gICAgZCAgICAgPSBkZWJ1ZyhcIk1ZQVBQXCIpICAgXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuZnVuY3Rpb24gZ3JlZXQoKSB7ICAgICAgICAgICBcbiAgZChcIiNncmVldCBjYWxsZWRcIikgICAgICAgICBcbiAgcmV0dXJuIFwiaGlcIiAgICAgICAgICAgICAgICBcbn0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIl19

Test

% npm install
% npm test

License

MIT (c) keik