str-amd-wrap

1.0.0 • Public • Published

Simple Wrapping of CommonJS to AMD

All this module does is wrap your CommonJS modules into the simplified CommonJS wrapper format, i.e.:

define(function (require, exports, module) {
    // your CommonJS code here
});

It takes in a string and gives back a string:

var amdWrap = require("str-amd-wrap");

var wrapped = amdWrap("module.exports = 5;");
var wrapThis = amdWrap(fs.readFileSync(__filename));

Line numbers will line up, although the first column will be shifted by "define (function (require, exports, module) {".length characters.

Difference from amd-wrap

This is similar to amd-wrap but adds features that transition param to javascript string var.

Readme

Keywords

none

Package Sidebar

Install

npm i str-amd-wrap

Weekly Downloads

13

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bacra