Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
turn generic javascript into AMD / commonJs loadable modules
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
LICENSE
README.md
package.json

README.md

Description

Turn your generic JavaScript files into loadable modules.

Usage

` var modulizer = require("modulize-generic-js"); var someSourceCodeStr = "var x = 'something'"; console.log( modulizer.convertCode(someSourceCodeStr, { "return": "x" }) );

var sourceFileName = "/somejs.js" var destFileName = "/modules/some/somejs.js"

modulizer.convertFile(sourceFileName, { require: [{ module: "/othermodule/main" , as: "otherVariable" }, "/othermodule/justload-dontrefer"] , "return": "moduleVariable" }, destFileName, function(err, data){}); `

the result will contain a header that is supposed to autodetect weather it is being loaded as AMD by the presence of a define function or as a commonJs module.

License

BSD

Something went wrong with that request. Please try again.