New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

amd-wrap

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amd-wrap

Wraps CommonJS files in `define(function (require, exports, module) { ... })`.

1.1.0
latest
Source
npm
Version published
Weekly downloads
232
-13.43%
Maintainers
1
Weekly downloads
 
Created
Source

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("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.

Keywords

amd

FAQs

Package last updated on 20 Mar 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts