diff --git a/crel.js b/crel.js index f2bf113..0da4e80 100644 --- a/crel.js +++ b/crel.js @@ -34,8 +34,16 @@ */ -window.crel = (function(undefined){ - +// if the module has no dependencies, the above pattern can be simplified to +(function (root, factory) { + if (typeof exports === 'object') { + module.exports = factory(); + } else if (typeof define === 'function' && define.amd) { + define(factory); + } else { + root.crel = factory(); + } +}(this, function () { // based on http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object var isNode = typeof Node === 'object' ? function (object) { return object instanceof Node } @@ -108,4 +116,4 @@ window.crel = (function(undefined){ crel["isNode"] = isNode; return crel; -})(); +})); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..aa6c7f0 --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "name": "crel", + "description": "A small, simple, and fast DOM creation utility", + "author": "Kory Nunn ", + "tags": [ + "DOM" + ], + "version": "0.0.0", + "main": "crel.js", + "dependencies": {}, + "devDependencies": { + }, + "repository": { + "type": "git", + "url": "git://github.com/KoryNunn/crel.git" + }, + "bugs": { + "url": "http://github.com/KoryNunn/crel/issues" + }, + "contributors": [] +} \ No newline at end of file