diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..180a963 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,20 @@ +Copyright (c) 2013 Mashdraggin + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e6f7d08 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +### helpers +helper functions for node.js +####installation +npm install helpers \ No newline at end of file diff --git a/node-helpers.js b/node-helpers.js new file mode 100644 index 0000000..472ebde --- /dev/null +++ b/node-helpers.js @@ -0,0 +1,47 @@ +/// +var path = require('path'); + +module.exports = function (filepath, _exports) { + /// Helper functions for requiring Node.js modules. + /// The filepath of the current module. + /// The _exports property of the current module. + /// Helper-methods object. + + var dirname = filepath || process.cwd(); + + function submodule(name) { + /// Require a local Node.js module file. + /// The filename of the module. + /// The Node.js module. + return require(path.resolve(dirname + path.sep + name)); + } + + function exp(name) { + /// Export a local module file as a property. + /// The filename of the module. + _exports[name] = submodule(name); + } + + function mixin(name, excludeNs) { + /// Mixin a local module file's methods with root namespace. + /// The filename of the module. + /// Whether to export module as a namespace also (default is true). + var sub = submodule(name); + for (var key in sub) { + if (sub.hasOwnProperty(key)) { + _exports[key] = sub[key]; + } + } + if (!excludeNs) { + // include methods in namespaced module + exp(name); + } + } + + return { + sub: submodule, + exp: exp, + mixin: mixin + }; + +}; diff --git a/npm-debug.log b/npm-debug.log new file mode 100644 index 0000000..cdeb649 --- /dev/null +++ b/npm-debug.log @@ -0,0 +1,45 @@ +0 info it worked if it ends with ok +1 verbose cli [ 'node', +1 verbose cli 'N:\\npm\\node_modules\\npm\\bin\\npm-cli.js', +1 verbose cli 'install', +1 verbose cli 'helpers' ] +2 info using npm@1.2.3 +3 info using node@v0.8.15 +4 verbose read json Z:\node-helpers\package.json +5 verbose read json Z:\node-helpers\package.json +6 verbose cache add [ 'helpers', null ] +7 verbose cache add name=undefined spec="helpers" args=["helpers",null] +8 verbose parsed url { pathname: 'helpers', path: 'helpers', href: 'helpers' } +9 silly lockFile 43a62a8c-helpers helpers +10 verbose lock helpers C:\Users\Nathan\AppData\Roaming\npm-cache\43a62a8c-helpers.lock +11 silly lockFile 43a62a8c-helpers helpers +12 verbose addNamed [ 'helpers', '' ] +13 verbose addNamed [ null, '' ] +14 silly lockFile a174c35b-helpers helpers@ +15 verbose lock helpers@ C:\Users\Nathan\AppData\Roaming\npm-cache\a174c35b-helpers.lock +16 silly addNameRange { name: 'helpers', range: '', hasData: false } +17 verbose url raw helpers +18 verbose url resolving [ 'https://registry.npmjs.org/', './helpers' ] +19 verbose url resolved https://registry.npmjs.org/helpers +20 info trying registry request attempt 1 at 23:56:51 +21 http GET https://registry.npmjs.org/helpers +22 http 404 https://registry.npmjs.org/helpers +23 silly registry.get cb [ 404, +23 silly registry.get { server: 'CouchDB/1.2.1 (Erlang OTP/R15B03)', +23 silly registry.get date: 'Tue, 26 Feb 2013 05:56:53 GMT', +23 silly registry.get 'content-type': 'application/json', +23 silly registry.get 'content-length': '52', +23 silly registry.get 'cache-control': 'must-revalidate' } ] +24 silly lockFile a174c35b-helpers helpers@ +25 error 404 'helpers' is not in the npm registry. +25 error 404 You should bug the author to publish it +25 error 404 +25 error 404 Note that you can also install from a +25 error 404 tarball, folder, or http url, or git url. +26 error System Windows_NT 6.1.7601 +27 error command "node" "N:\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "helpers" +28 error cwd Z:\node-helpers +29 error node -v v0.8.15 +30 error npm -v 1.2.3 +31 error code E404 +32 verbose exit [ 1, true ] diff --git a/package.json b/package.json new file mode 100644 index 0000000..10f771b --- /dev/null +++ b/package.json @@ -0,0 +1 @@ +{"name":"helpers","description":"helper functions for node.js","version":"0.0.1","author":"Mashdraggin","license":"MIT","repository":{"type":"git","url":"https://github.com/fshost/helpers.git"},"scripts":{"test":"node ./test/test"},"readme":"### helpers\nhelper functions for node.js\n####installation\nnpm install helpers","readmeFilename":"README.md"} \ No newline at end of file