transform-deps
parse the ast and transform require() calls
Last updated 4 years ago by tetsuo .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install transform-deps 
SYNC missed versions from official npm registry.

transform-deps

parse the ast and transform require() calls.

example

var transform = require('transform-deps');
var src = "require('x'); require('y');"
src = transform(src, function (name) {
	if (name == 'x') return 'z';
});
console.log(src);

outputs:

require('z'); require('y')

api

var transform = require('transform-deps')

var str = transform(src[, opts], cb)

Transforms the string source src with the function cb, returning transformed string str.

opts are:

  • asString: Returns a plain string instead of falafel output (default: true)
  • ignoreTryCatch: Skips try/catch statements (default: false)

All of the opts will be passed to falafel.

license

mit

Current Tags

  • 2.0.0                                ...           latest (4 years ago)

4 Versions

  • 2.0.0                                ...           4 years ago
  • 1.0.0                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 2
Last Month 6
Dependencies (2)
Dev Dependencies (0)
None

Copyright 2014 - 2017 © taobao.org |