phetsims / query-string-machine

Query String Machine is a query string parser that supports type coercion, default values & validation. No dependencies.
MIT License
3 stars 3 forks source link

Support UMD #14

Closed samreid closed 8 years ago

samreid commented 8 years ago

@zepumph and I would like to support UMD for using QueryStringMachine in node

zepumph commented 8 years ago

var scope;

// if the module has no dependencies, the above pattern can be simplified to (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define([], factory); } else if (typeof module === 'object' && module.exports) { // Node. Does not work with strict CommonJS, but // only CommonJS-like environments that support module.exports, // like Node. scope = global; module.exports = factory(); } else { // Browser globals (root is window) scope = window; root.returnExports = factory(); } }(this, function () {

// Just return a value to define the module export. // This example returns an object, but the module // can return a function as the exported value. return QueryStringMachine; }));

samreid commented 8 years ago

Working well, closing.