Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Make an ordinary JavaScript object into a superheroic module (CommonJS, AMD, or global)

Notifications You must be signed in to change notification settings

chriskwan/module-maker

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

module-maker

Make an ordinary JavaScript object into a superheroic module (CommonJS, AMD, or global)

Installation

npm install module-maker --save

Usage

// Some ordinary JavaScript object you want to share
var Greeter = {
    speak: function () {
        alert("Hello World!");
    }
};

// Make a module out of your object
// (it will try to make both CommonJS and AMD modules
// and fallback to making a global if neither of those work)

var moduleMaker = require("module-maker");
moduleMaker.make({
    obj: Greeter,
    moduleObj: module, // the actual reserved word
    name: "Greeter" // omit if you want to make an anonymous AMD module
});

Other Available Methods

moduleMaker.makeCommonJS({
    obj: Greeter,
    moduleObj: module // the actual reserved word
});

moduleMaker.makeAMD({
    obj: Greeter,
    name: "Greeter" // omit if you want to make an anonymous AMD module
});

moduleMaker.makeGlobal({
    obj: Greeter,
    name: "Greeter"
});

Building

  1. Run npm install to get dependencies
  2. Make changes to src/module-maker.js (in ES6/ES2015)
  3. Run npm run build to generate output file lib\module-maker.js

About

Make an ordinary JavaScript object into a superheroic module (CommonJS, AMD, or global)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
Morty Proxy This is a proxified and sanitized view of the page, visit original site.