Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed commit errors

  • Loading branch information...
commit b834ee5cdb8bb1ee8fc03d97518d966f06a79fae 1 parent e948f9d
Sergio Lepore authored
Showing with 44 additions and 0 deletions.
  1. +1 −0  index.js
  2. +24 −0 lib/cation.js
  3. +19 −0 package.json
View
1  index.js
@@ -0,0 +1 @@
+module.exports = require('./lib/cation');
View
24 lib/cation.js
@@ -0,0 +1,24 @@
+var cation = module.exports = function(dir, modules) {
+ cation.load_dir = dir + '/';
+ cation.module_schema = modules;
+ cation.module_store = {};
+
+ return cation;
+};
+
+cation.load = function(name) {
+ if (this.module_schema.hasOwnProperty(name)) {
+ var module_path = this.module_schema[name];
+ module_path = (module_path.indexOf('.') === 0) ? this.load_dir + module_path : module_path;
+
+ this.module_store[name] = require(module_path);
+ }
+};
+
+cation.get = function(name) {
+ if (!this.module_store.hasOwnProperty(name)) {
+ this.load(name);
+ }
+
+ return this.module_store[name];
+};
View
19 package.json
@@ -0,0 +1,19 @@
+{
+ "name": "cation",
+ "description": "Node.js Dependency Container",
+ "version": "0.1.1",
+ "author": "Moobin <info@moobin.net>",
+ "maintainers": [
+ "sergiolepore <slepore@moobin.net>",
+ "MarceloMira <mmira@moobin.net>",
+ "joelalejandro <joel.alejandro@moobin.net>"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/Moobin/Cation.git"
+ },
+ "main": "./lib/cation",
+ "engines": {
+ "node": ">= 0.8.9"
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.