wrapfor
Wrap code for usage as an amd/cjs/whatever module.
Examples
var input = "var method = function () { return true; };"
Generate an AMD module:
wrapfor; // ^ returns a string containing;
Generate an AMD module with dependencies inline:
wrapfor; // ^ returns a string containing;
Generate a CommonJS module:
wrapfor; // ^ returns a string containingvar { return true; };moduleexports = method;
Generate a CommonJS module with dependencies inline:
wrapfor; // ^ returns a string containingvar _ = ;var { return true; };moduleexports = method;
Usage
wrapforwrapfor
input
Type: String
Default: 'none'
A string containing javascript to be wrapped.
opts
Type: Object
Default: {}
A configuration object supporting the following keys:
exports
: the variable to exportdeps
: an object listing dependencies to load and which variable to store them in
Release History
- 2013-11-04 - v0.1 - initial release