Generates nodejs modules from source code.
You can download it from github at https://github.com/matthewkastor/modulify or, if you have node installed you can get it from npm
npm install modulify
Using this module in your browser is as simple as including both
node_modules/esprima/esprima.js in the page, parsing the source code with esprima and calling
modulify.generateModuleString. There is an example below.
It is much easier to use this code within nodejs and that is the recommended
See try it.html
in the root directory of this package for a working example of browser usage.
Simply require it and use it.
var modulify = require('modulify');var result = modulify.file( /** file path **/);// result will contain the modulified version of the source.
There is also a method
modulify.string that takes a single string argument and
returns a modulified version. See the documentation for other utility methods.
Run the tests in node with
npm test. Run the tests in your browser by opening