Last active
February 11, 2024 23:16
-
-
Save juanbrujo/5949f55ae4593d1ba334 to your computer and use it in GitHub Desktop.
Starter for a basic NPM module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// moduleName = name of your npm module | |
var moduleName = (function moduleName() { | |
"use strict"; | |
// YOUR PRETTY JS CODE THAT WILL CHANGE THE WORLD | |
// return whatever; | |
})( this ); | |
if ( typeof module !== "undefined" && module.exports ) { | |
// export for use in Node | |
module.exports.moduleName = function ( @params ) { | |
return moduleName( @params ); | |
}; | |
} else if ( typeof define !== "undefined" && define.amd ) { | |
// export for use in AMD | |
define([], function ( @params ) { | |
return moduleName( @params ); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment