From 99e6a0cc379dbe426b55bf679719aac48672991f Mon Sep 17 00:00:00 2001 From: "Nicolab.net" Date: Sat, 13 Sep 2014 18:30:20 +0200 Subject: [PATCH] [browser] Rebuild to v1.0.1 --- browser/noder-dev.js | 16 +++++++++++++--- browser/noder-dev.js.map | 2 +- browser/noder.js | 4 ++-- package.json | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/browser/noder-dev.js b/browser/noder-dev.js index a6fdf32..dc14f39 100644 --- a/browser/noder-dev.js +++ b/browser/noder-dev.js @@ -1,3 +1,4 @@ +/*! Noder.io | (c) 2014 Nicolas Tallefourtane | http://noder.io */ /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -47,10 +48,19 @@ \************************/ /***/ function(module, exports, __webpack_require__) { - 'use strict'; - - /*! Noder.io | (c) 2014 Nicolas Tallefourtane | http://noder.io */ + /** + * This file is part of Noder.io. + * + * (c) Nicolas Tallefourtane + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code + * or visit http://noder.io. + * + * @author Nicolas Tallefourtane + */ + 'use strict'; /*----------------------------------------------------------------------------*\ Polyfill diff --git a/browser/noder-dev.js.map b/browser/noder-dev.js.map index d90698d..c2c3727 100644 --- a/browser/noder-dev.js.map +++ b/browser/noder-dev.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap ca3ac5c9a0f1f85ffa8d","webpack:///./src/browser.js","webpack:///./src/index.js","webpack:///./src/collection.js","webpack:///./src ^\\.\\/.*$","webpack:///./src/utils.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,wC;;;;;;;;;;ACtCA;;AAEA;;;AAGA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,sD;;;;;;;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAU;AACV;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA,WAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA,2CAA0C,aAAa;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA,6CAA4C,aAAa;AACzD;AACA;AACA;AACA;AACA,aAAY,WAAW;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAY,MAAM;AAClB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAY,uBAAuB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA,aAAY,MAAM;AAClB;AACA,aAAY,UAAU;AACtB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,8DAA6D;AAC7D,oCAAmC;AACnC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAG;;AAEH;;AAEA;;AAEA,IAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,sBAAsB;AACjC,YAAW,SAAS;AACpB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,sBAAsB;AACjC,YAAW,SAAS;AACpB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,sBAAsB;AACjC,YAAW,SAAS;AACpB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,sBAAsB;AACjC,YAAW,SAAS;AACpB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA,YAAW,SAAS;AACpB;AACA;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA,YAAW,gBAAgB;AAC3B,YAAW,SAAS;AACpB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAY,MAAM;AAClB,aAAY,SAAS;AACrB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,gBAAgB;AAC3B;AACA;AACA;AACA,YAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAY,MAAM;AAClB;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAY,OAAO;AACnB,aAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;;;AAGA;;;;;;;;;;AC1gBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,KAAK;AACjB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,WAAW;AACvB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,MAAM;AACjB,aAAY,WAAW;AACvB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA,YAAW,OAAO;AAClB;AACA,aAAY,WAAW;AACvB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA,aAAY,WAAW;AACvB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA,YAAW,MAAM;AACjB;AACA,YAAW,KAAK;AAChB;AACA;AACA;AACA,aAAY,WAAW;AACvB;AACA,aAAY,UAAU;AACtB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA,YAAW,KAAK;AAChB;AACA;AACA;AACA,aAAY,WAAW;AACvB;AACA,aAAY,UAAU;AACtB,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAY,OAAO;AACnB,YAAW,UAAU;AACrB;AACA,aAAY,WAAW;AACvB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA,YAAW,MAAM;AACjB;AACA;AACA;AACA,YAAW,KAAK;AAChB;AACA;AACA;AACA,aAAY,MAAM;AAClB,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA,aAAY,UAAU;AACtB,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA,OAAM;AACN;AACA,YAAW,OAAO;AAClB;AACA,YAAW,MAAM;AACjB;AACA;AACA;AACA,YAAW,KAAK;AAChB;AACA;AACA;AACA,aAAY,MAAM;AAClB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA,aAAY,UAAU;AACtB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA,YAAW,sBAAsB;AACjC;AACA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA;AACA;AACA,aAAY,MAAM;AAClB;AACA,aAAY,UAAU;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA,YAAW,sBAAsB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA;AACA;AACA,aAAY,MAAM;AAClB;AACA,aAAY,UAAU;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAY,gBAAgB;AAC5B;AACA;AACA,YAAW,SAAS;AACpB;AACA;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,aAAY,MAAM;AAClB,aAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA,YAAW,SAAS;AACpB;AACA;AACA,aAAY,WAAW;AACvB;AACA,aAAY,UAAU;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA,YAAW,OAAO;AAClB,YAAW,sBAAsB;AACjC,YAAW,SAAS;AACpB;AACA,aAAY,WAAW;AACvB;AACA,aAAY,UAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA,YAAW,OAAO;AAClB,YAAW,sBAAsB;AACjC,YAAW,SAAS;AACpB;AACA,aAAY,WAAW;AACvB;AACA,aAAY,UAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA,6B;;;;;;;;;AC3xBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAiC,uDAAuD;AACxF;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,iBAAgB;AAChB,iBAAgB;AAChB;AACA;AACA,eAAc;AACd;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAW,aAAa;AACxB,YAAW,gBAAgB;AAC3B,aAAY,OAAO;AACnB;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,kBAAiB,YAAY;AAC7B;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA,G","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap ca3ac5c9a0f1f85ffa8d\n **/","'use strict';\n\n/*! Noder.io | (c) 2014 Nicolas Tallefourtane | http://noder.io */\n\n\n/*----------------------------------------------------------------------------*\\\n Polyfill\n\\*----------------------------------------------------------------------------*/\n\nif(!Array.isArray) {\n\n var toString = Object.prototype.toString();\n\n Array.isArray = function isArray(array) {\n\n if (toString.call(array) === '[object Array]') {\n return true;\n } else if ( typeof array.slice === 'function' &&\n typeof array.length === 'number') {\n return true;\n }\n\n return false;\n };\n}\n\n// expose\nwindow.noder = require('./index');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/browser.js\n ** module id = 0\n ** module chunks = 0\n **/","/**\n * This file is part of Noder.io.\n *\n * (c) Nicolas Tallefourtane \n *\n * For the full copyright and license information, please view\n * the LICENSE file that was distributed with this source code\n * or visit http://noder.io.\n *\n * @author Nicolas Tallefourtane \n */\n\n'use strict';\n\nvar Collection = require('./collection');\n\n// modules loaded\nvar loaded = {};\n\n/**\n * `Noder` constructor.\n *\n * The `Noder` instance is created when the first usage of `require('noder.io')`,\n * then the same object (reference) is returned by `require('noder.io')` in the next usages.\n *\n * @example\n * // file: a.js\n * var noder = require('noder.io');\n *\n * // true\n * console.log(typeof noder === 'object');\n *\n * // true\n * console.log(noder instanceof noder.Noder);\n *\n * noder.set('hello', '-> Hello from a.js file.');\n *\n * // file: b.js\n * var noder = require('noder.io');\n *\n * // -> Hello from a.js file.\n * console.log(noder.get('hello'));\n *\n * @constructor\n *\n * @see Noder.Noder\n */\nfunction Noder() {\n\n this.$di = new Noder.prototype.$di();\n\n this.$di.addAll({\n '$api' : this,\n '$di' : this.$di,\n '$container' : this.$di._container,\n '$invoke' : this.$wrap(this.$invoke),\n '$inject' : this.$wrap(this.$inject),\n '$provider' : this.$wrap(this.$provider),\n '$factory' : this.$wrap(this.$factory),\n '$singleton' : this.$wrap(this.$singleton),\n '$apply' : this.$wrap(this.$apply),\n '$wrap' : this.$wrap(this.$wrap)\n });\n}\n\n/**\n * `Noder` constructor.\n * For creating a new instance of `Noder`.\n *\n * @example\n * var api = new noder.Noder();\n *\n * @constructor\n * @type {function}\n */\nNoder.prototype.Noder = Noder;\n\n/**\n * IOC container.\n *\n * See [Collection API doc](collection.html).\n *\n * @example\n * noser.$di.set('name', Nico);\n *\n * var hello = noder.$di.apply(function() {\n * return 'Hello ' + this.name;\n * });\n *\n * @type {Collection}\n *\n * @see Noder.$invoke()\n * @see Noder.$inject()\n * @see Noder.$provider()\n * @see Noder.$factory()\n * @see Noder.$singleton()\n * @see Noder.$apply()\n * @see Noder.$wrap()\n */\nNoder.prototype.$di = Collection;\n\n/**\n * `Collection` constructor.\n * For creating a new instance of `Collection`.\n *\n * @example\n * var collection = new noder.Collection();\n *\n * collection.set('keyName', 'any value');\n *\n * // any value\n * console.log(collection.get('keyName'));\n *\n *\n * @constructor\n *\n * @param {object} [values] (Optional) values to add in the collection.\n * ```js\n * var collection = new noder.Collection({'foo': 'bar'});\n *\n * // display \"bar\"\n * console.log(collection.get('foo'));\n * ```\n *\n * @see Noder.createCollection()\n * @see Noder.Noder\n */\nNoder.prototype.Collection = Collection;\n\n/**\n * Create a collection container.\n *\n * @example\n * var collection = noder.createCollection();\n *\n * // true\n * console.log(collection instanceof noder.Collection);\n *\n * collection.set('keyName', 'any value');\n *\n * // any value\n * console.log(collection.get('keyName'));\n *\n * @param {object} [values] Optional values to add in the new collection.\n * ```js\n * var collection = noder.createCollection({'foo': 'bar'});\n *\n * // display \"bar\"\n * console.log(collection.get('foo'));\n * ```\n * @return {Collection} The new `Collection` instance\n *\n * @see Noder.Collection\n * @see Noder.createNoder()\n */\nNoder.prototype.createCollection = function createCollection(values) {\n\n if(values) {\n return new this.Collection(values);\n }\n\n return new this.Collection();\n};\n\n/**\n * Create a new `Noder` instance.\n *\n * @example\n * var api = noder.createNoder();\n *\n * // true\n * console.log(api instanceof noder.Noder);\n *\n * @return {Noder} The new `Noder` instance\n */\nNoder.prototype.createNoder = function createNoder() {\n\n return new this.Noder();\n};\n\n/**\n * Use a noder plugin.\n * A plugin is initialized by the method `__noder()`.\n *\n * See also [plugins](/guide/plugins.html) in the guide.\n *\n * @example\n * // example-plugin.js *\n * module.exports.__noder = examplePlugin(noder, arg1, arg2) {\n *\n * noder.$di.set('foo', arg1 + ' and ' + arg2);\n *\n * return noder;\n * };\n *\n * // app.js\n * var noder = require('noder.io').createNoder();\n * var examplePlugin = require('./example-plugin');\n *\n * noder.use(examplePlugin, 'any value 1', 'any value 2');\n *\n * // displays: 'any value 1 and any value 2'\n * console.log(noder.$di.get('foo'));\n *\n * @param {string|object|function} noderPlugin A noder plugin.\n * If `noderPlugin` is:\n *\n * * `string`: the plugin is loaded with `require`\n * and called by passing the current instance of `noder` like\n *\n * ```js\n * require(noderPlugin).__noder(noder [, optional argument, ...]);\n * ```\n * * `object` or `function`: the method `__noder()` is called by passing\n * the current instance of `noder` like\n *\n * ```js\n * noderPlugin.__noder(noder [, optional argument, ...]);\n * ```\n *\n * @param {...mixed} [arguments] Zero, one or several arguments passed to plugin.\n *\n * @return {Noder} The current `Noder` instance.\n *\n * @throws {TypeError} If the plugin has not the method [__noder()](/guide/plugins.html).\n */\nNoder.prototype.use = function use(noderPlugin) {\n\n var initPlugin = function(plugin, args) {\n\n if(typeof plugin.__noder != 'function') {\n throw new TypeError(\n 'Argument #1 passed to Noder.use() is not a valid plugin for Noder.io.' +\n 'A plugin must implement a method named `__noder()` that is used for ' +\n 'initialization. Example: ' +\n '`module.exports.__noder = function MyPlugin(noder) {\\n ' +\n '// here, the bootstrap\\n};`' +\n '\\n\\nAPI doc: http://noder.io/api/noder.html#use'\n );\n }\n\n plugin = plugin.__noder;\n\n args.length > 1 ?\n plugin.apply(null,\n Array.prototype.concat.apply(\n [this], Array.prototype.slice.call(args, 1)\n )\n )\n : plugin(this);\n\n }.bind(this);\n\n if(typeof noderPlugin == 'string') {\n\n initPlugin(require(noderPlugin), arguments);\n\n }else{\n\n initPlugin(noderPlugin, arguments);\n }\n\n return this;\n};\n\n/**\n * Shortcut of `noder.$di.invoke()`.\n *\n * Call a function with dependencies injection.\n *\n * Unlike `noder.$invoke()`,\n * the returned value of each dependency is passed to `fn`.\n *\n * @param {string|array|function} deps See [Collection.invoke()](collection.html#invoke).\n * @param {function} [fn] See [Collection.invoke()](collection.html#invoke).\n *\n * @return {mixed} The result of `fn`.\n *\n * @see Collection.invoke()\n * @see Noder.$inject()\n */\nNoder.prototype.$invoke = function $invoke(deps, fn) {\n\n return this.$di.invoke(deps, fn);\n};\n\n/**\n * Shortcut of `noder.$di.inject()`.\n *\n * Call a function with dependencies injection.\n *\n * Unlike `noder.$invoke()`,\n * the raw value of each dependency is passed to `fn`.\n *\n * @param {string|array|function} deps See [Collection.inject()](collection.html#inject).\n * @param {function} [fn] See [Collection.inject()](collection.html#inject).\n *\n * @return {mixed} The result of `fn`.\n *\n * @see Collection.inject()\n * @see Noder.$invoke()\n */\nNoder.prototype.$inject = function $inject(deps, fn) {\n\n return this.$di.inject(deps, fn);\n};\n\n/**\n * Shortcut of `noder.$di.provider()`.\n *\n * Create a `provider` that supports dependencies injection.\n * When the item `key` is called,\n * it calls the function `fn` by passing dependencies `deps`.\n *\n * This method defines a function that returns the result\n * of `noder.$di.inject(deps, fn)`.\n *\n * @param {string} key The key (provider identifier).\n * @param {string|array|function} deps See [Noder.$inject()](#$inject).\n * @param {function} [fn] See [Noder.$inject()](#$inject).\n *\n * @return {Noder} The current `Noder` instance.\n *\n * @see Collection.provider()\n * @see Noder.$inject()\n * @see Noder.$factory()\n * @see Noder.$singleton()\n * @see Noder.$wrap()\n */\nNoder.prototype.$provider = function $provider(key, deps, fn) {\n\n this.$di.provider(key, deps, fn);\n\n return this;\n};\n\n/**\n * Shortcut of `noder.$di.factory()`.\n *\n * Create a `factory` that supports dependencies injection.\n * When the item `key` is called,\n * it calls the function `fn` by passing dependencies `deps`.\n *\n * This method defines a function that returns the result\n * of `noder.$di.invoke(deps, fn)`.\n *\n * @param {string} key The key (factory identifier).\n * @param {string|array|function} deps See [Noder.$invoke()](#$invoke).\n * @param {function} [fn] See [Noder.$invoke()](#$invoke).\n *\n * @return {Noder} The current `Noder` instance.\n *\n * @see Collection.factory()\n * @see Noder.$invoke()\n * @see Noder.$provider()\n * @see Noder.$singleton()\n * @see Noder.$wrap()\n */\nNoder.prototype.$factory = function $factory(key, deps, fn) {\n\n this.$di.factory(key, deps, fn);\n\n return this;\n};\n\n/**\n * Shortcut of `noder.$di.singleton()`.\n *\n * Create a singleton (function shared).\n *\n * @param {string} key The key (function identifier).\n *\n * @param {function} fn The function, executed once,\n * after the value is returned when is again called.\n *\n * @return {Noder} The current `Noder` instance.\n *\n * @see Collection.singleton()\n * @see Noder.$provider()\n * @see Noder.$factory()\n * @see Noder.$wrap()\n */\nNoder.prototype.$singleton = function $singleton(key, fn) {\n\n this.$di.singleton(key, fn);\n\n return this;\n};\n\n/**\n * Shortcut of `noder.$di.apply()`.\n *\n * Calls a given function by binding the scope (`this`) to the `$di` container\n * (`noder.$di._container`).\n *\n * @example\n * noder.set('name', 'Nico');\n *\n * // returns 'Nico'\n * noder.$apply(function() {\n * return this.name;\n * });\n *\n * @param {function|object} bindable See [Collection.apply()](collection.html#apply).\n * @param {...mixed} [arguments] Zero, one or more arguments passed to `bindable`.\n *\n * @return {mixed} The value returned by `bindable`.\n *\n * @see Collection.apply()\n * @see Noder.inject()\n */\nNoder.prototype.$apply = function $apply(bindable) {\n\n return this.$di.apply(bindable);\n};\n\n/**\n * Shortcut of `noder.$di.wrap()`.\n *\n * Wrap a value.\n * Useful to avoid calling a function in the implementation\n * of a _provider_ or a _factory_.\n *\n * @param {mixed} value The value to wrap.\n * @return {function} `value` wrapped by a function.\n *\n * @see Collection.wrap()\n */\nNoder.prototype.$wrap = function $wrap(value) {\n\n return this.$di.wrap(value);\n};\n\n/**\n * Lazy `require()`, register a new lazy loadable property\n * whose the value will be assigned on the fly with `require()` only when it is used.\n *\n * The property configuration is :\n * * enumerable: true,\n * * configurable: false,\n * * writable: false\n *\n * @example\n * // Register `markdown` property\n * // Note: `marked` module is not loaded\n * noder.$require('markdown', 'marked');\n *\n * // Now load the `marked` module in the `markdown` property\n * noder.markdown;\n *\n * @param {string|function} property The property name\n * or `required` value if the `required`\n * argument is not provided (shortcut).\n *\n * @param {string|function} [required] The module name or the JS file path\n * required to set the property value.\n * Or a custom loader handler\n * via a given function.\n *\n * Note:\n * * The `required` argument is passed to the function `require()`.\n * * The `required` item is only loaded the first time (singleton).\n *\n * @return {Noder} The current `Noder` instance.\n */\nNoder.prototype.$require = function $require(property, required) {\n\n Object.defineProperty(this, property, {\n\n enumerable : true,\n configurable : false,\n\n get: function() {\n\n if (this.$require.isLoaded(property)) {\n return loaded[property];\n }\n\n if(typeof required === 'undefined') {\n required = property;\n }\n\n loaded[property] = (typeof required === 'function' ?\n required.call(this._container) : require(required));\n\n return loaded[property];\n },\n\n set: function() {\n throw new Error(\n '\"' + property +'\" property is not writable because is a placeholder ' +\n 'of a property of a lazy loading module.'\n );\n }\n });\n\n return this;\n};\n\n/**\n * Check if a given module is loaded.\n *\n * @example\n * noder.$require('express');\n *\n * // false\n * console.log(noder.$require.isLoaded('express'));\n *\n * var express = noder.express;\n *\n * // true\n * console.log(noder.$require.isLoaded('express'));\n *\n * @param {string} property The property name.\n * @return {bool} `true` if the given module is loaded, `false` otherwise.\n * @see Noder.$require()\n */\nNoder.prototype.$require.isLoaded = function isLoaded(property) {\n return (undefined !== loaded[property]);\n};\n\n\nmodule.exports = new Noder();\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/index.js\n ** module id = 1\n ** module chunks = 0\n **/","/**\n * This file is part of Noder.io.\n *\n * (c) Nicolas Tallefourtane \n *\n * For the full copyright and license information, please view\n * the LICENSE file that was distributed with this source code\n * or visit http://noder.io.\n *\n * @author Nicolas Tallefourtane \n */\n\n'use strict';\n\nvar utils = require('./utils');\n\n/**\n * Create a new collection.\n *\n * @constructor\n *\n * @example\n * var items = new Collection();\n *\n * @param {object} [values] Values to add in the collection.\n * @throws {TypeError} If the arguments `values` is provided is not an `object`.\n */\nfunction Collection(values) {\n\n /**\n * Items container.\n * All values of the collection are stored in the container.\n * @type {object}\n */\n this._container = values || {};\n\n if (values && typeof values !== 'object') {\n throw new TypeError(\n 'Argument #1 passed to Collection must be an object'\n );\n }\n}\n\n/**\n * Get all keys of the collection.\n *\n * @example\n * items.keys();\n *\n * @return {array} An array of keys.\n */\nCollection.prototype.keys = function keys() {\n return Object.keys(this._container);\n};\n\n/**\n * Checks if an item exists\n *\n * @example\n * items.set('keyName', 'any value');\n *\n * if(items.has('keyName')) {\n * console.log('has `keyName`');\n * }\n *\n * @param {string} key The key of the item to check.\n * @return {bool} `true` if exists, `false` otherwise.\n * @throws {TypeError} If `key` is not a `string`.\n */\nCollection.prototype.has = function has(key) {\n\n if (typeof key !== 'string') {\n throw new TypeError(\n 'Argument #1 passed to Collection.has() must be a string identifier, ' +\n Object.prototype.toString(key) + ' given'\n );\n }\n\n return (key in this._container === true);\n};\n\n/**\n * Remove an item.\n *\n * @example\n * items.set('keyName', 'any value');\n *\n * // true\n * console.log(items.has('keyName'));\n *\n * items.remove('keyName');\n *\n * // false\n * console.log(items.has('keyName'));\n *\n * @param {string} key The key of item to remove.\n * @return {Collection} The current ìnstance.\n * @throws {TypeError} If `key` is not a `string`.\n */\nCollection.prototype.remove = function remove(key) {\n\n if (typeof key !== 'string') {\n throw new TypeError(\n 'Argument #1 passed to Collection.remove() must be a string ' +\n 'identifier'\n );\n }\n\n delete this._container[key];\n\n return this;\n};\n\n/**\n * Set an item.\n *\n * @example\n * items.set('hello', 'Hello World!');\n *\n * // Hello World!\n * console.log(items.get('hello'));\n *\n * @param {string} key Key name.\n * @param {mixed} value The value.\n * @return {Collection} The current ìnstance.\n * @throws {TypeError} If `key` is not a `string`.\n */\nCollection.prototype.set = function set(key, value) {\n\n if (typeof key !== 'string') {\n throw new TypeError(\n 'Argument #1 passed to Collection.set() must be a string identifier'\n );\n }\n\n this._container[key] = value;\n\n return this;\n};\n\n/**\n * Set all items of the collection.\n * All collection is overwritten by the given set of items.\n *\n * @example\n * items.setAll({\n * a: 'value 1',\n * b: 'value 2',\n * c: 'value 3'\n * });\n *\n * @param {values} values The new values of the collection.\n *\n * @return {Collection} The current ìnstance.\n * @throws {TypeError} If `values` is not an `object`.\n */\nCollection.prototype.setAll = function setAll(values) {\n\n if (typeof values !== 'object') {\n throw new TypeError(\n 'Argument #1 passed to Collection.setAll() must be an object'\n );\n }\n\n this._container = values;\n\n return this;\n};\n\n/**\n * Add all items in the collection.\n *\n * items.addAll({\n * a: 'value 1',\n * b: 'value 2',\n * c: 'value 3'\n * });\n *\n * @param {object} values The values to add.\n * The existing values are overwritten,\n * the other items are preserved.\n *\n * @return {Collection} The current ìnstance.\n * @throws {TypeError} If `values` is not an `object` or if a key is not a `string`.\n */\nCollection.prototype.addAll = function addAll(values) {\n\n if (typeof values !== 'object') {\n throw new TypeError(\n 'Argument #1 passed to Collection.addAll() must be an object'\n );\n }\n\n for (var key in values) {\n this.set(key, values[key]);\n }\n\n return this;\n};\n\n/**\n * Add once an item in the collection.\n * Identical to [Collection.set()](#set) method, except the item is added only\n * if it is not already defined in the collection.\n *\n * @param {string} key The key name.\n *\n * @param {mixed} value The value.\n *\n * @param {bool} [skip_if_exists] Defines the behavior if the given key exists:\n * * if `truthy`, nothing happens and the item already defined is not overwritten\n * * if `falsy` (by default) an `Error` is thrown\n *\n * @return {Collection} The current ìnstance.\n *\n * @throws {TypeError} If `key` is not a `string`.\n *\n * @throws {Error} If an item is already defined\n * with the same `key` and `skip_if_exists` is not `truthy`.\n *\n * @see Collection.addOnceAll()\n * @see Collection.set()\n */\nCollection.prototype.addOnce = function addOnce(key, value, skip_if_exists) {\n\n if (this.has(key)) {\n\n if (skip_if_exists){\n return this;\n }\n\n throw new Error(\n 'Identifier ' + key + ' passed to Collection.addOnce() ' +\n 'is already defined'\n );\n }\n\n return this.set(key, value);\n};\n\n/**\n * Add all items in the collection only if not already defined.\n *\n * @param {object} values Identical to [Collection.addAll()](#addAll) method.\n *\n * @param {bool} [skip_if_exists] Defines the behavior if an item exists:\n * * if `truthy`, nothing happens and the item already defined is not overwritten\n * * if `falsy` (by default) an `Error` is thrown\n *\n * @return {Collection} The current ìnstance.\n *\n * @throws {TypeError} If `values` is not an `object` or if a key is not a `string`.\n * @throws {Error} If an item is already defined and `skip_if_exists` is not `truthy`.\n *\n * @see Collection.addOnce()\n * @see Collection.addAll()\n */\nCollection.prototype.addOnceAll = function addOnceAll(values, skip_if_exists) {\n\n if (typeof values !== 'object') {\n throw new TypeError(\n 'Argument #1 passed to Collection.addOnceAll() must be an object'\n );\n }\n\n for (var key in values) {\n this.addOnce(key, values[key], skip_if_exists);\n }\n\n return this;\n};\n\n/**\n * Merge `values` (recursive) in the collection.\n *\n * @param {object} values Values to merge.\n * @param {...object} [values] Zero, one or several other objects.\n *\n * @return {Collection} The current ìnstance.\n * @throws {TypeError} If `values` is not an `object`.\n */\nCollection.prototype.merge = function merge(values) {\n\n if (typeof values !== 'object') {\n throw new TypeError(\n 'Argument #1 passed to Collection.merge() must be an object'\n );\n }\n\n var args = Array.prototype.concat.apply([this._container], arguments);\n\n this._container = utils.mergeRecursive.apply(utils, args);\n\n return this;\n};\n\n/**\n * Get all items of the collection.\n *\n * @return {object} All items defined in the collection.\n */\nCollection.prototype.getAll = function getAll() {\n\n return this._container;\n};\n\n/**\n * Get an item value.\n *\n * If the item is a function, the fonction is called\n * and `get()` returns the value returned by the function called.\n *\n * If you want the raw value, uses [Collection.raw()](#raw).\n *\n * @example\n * items.addAll({\n * a: 'value of \"a\"',\n * b: function() {\n * 'value of \"b\"'\n * }\n * });\n *\n * // value of \"a\", string\n * console.log(items.get('a'), typeof items.get('a'));\n *\n * // value of \"b\", string\n * console.log(items.get('b'), typeof items.get('b'));\n *\n * // value of \"a\", string\n * console.log(items.raw('a'), typeof items.raw('a'));\n *\n * // [Function], function\n * console.log(items.raw('b'), typeof items.raw('b'));\n *\n * @param {string} key The key of the item\n *\n * @param {mixed} [default_value] The default value if the item\n * does not exist (`default_value` is ignored\n * if `strict` is `truthy`).\n *\n * @param {bool} [strict] If `truthy` and the item does not exist,\n * throws an `Error` (`default_value` is ignored\n * if `strict` is `truthy`).\n *\n * @return {mixed} The item value (if defined).\n * @return {mixed} Returns `default_value` if:\n * * a default value is defined\n * * `strict` is not `truthy`\n * * the item (`key`) does not exist\n *\n * @throws {TypeError} If `key` is not a `string`.\n * @throws {Error} If `strict` is `truthy` and the item does not exist.\n *\n * @see Collection.raw()\n * @see Collection.apply()\n * @see Collection.invoke()\n */\nCollection.prototype.get = function get(key, default_value, strict) {\n\n if (typeof this._container[key] === 'function') {\n return this._container[key]();\n }\n\n if (this.has(key)) {\n return this._container[key];\n }\n\n if (typeof default_value === 'function') {\n return this.raw(key, default_value, strict)();\n }\n\n return this.raw(key, default_value, strict);\n};\n\n/**\n * Get an item.\n *\n * @example\n * items.set('multiply', function(a, b) {\n * return a * b;\n * });\n *\n * var multiply = items.raw('multiply');\n *\n * // returns 8\n * multiply(2, 4);\n *\n * // or directly\n * // returns 8\n * items.raw('multiply')(2, 4);\n *\n * // or equivalent by injection\n *\n * // returns 8\n * items.inject('multiply', function(multiply) {\n * return multiply(2, 4);\n * });\n *\n * // returns 8\n * items.apply(function() {\n * return this.multiply(2, 4);\n * });\n *\n * @param {string} key The key of the item\n *\n * @param {mixed} [default_value] The default value if the item\n * does not exist (`default_value` is ignored\n * if `strict` is `truthy`).\n *\n * @param {bool} [strict] If `truthy` and the item does not exist,\n * throws an `Error` (`default_value` is ignored\n * if `strict` is `truthy`).\n *\n * @return {mixed} The item value (if defined).\n *\n * @return {mixed} Returns `default_value` if:\n * * a default value is defined\n * * `strict` is not `truthy`\n * * the item (`key`) does not exist\n *\n * @throws {TypeError} If `key` is not a `string`.\n *\n * @throws {Error} If `strict` is `truthy` and the item does not exist.\n *\n * @see Collection.get()\n * @see Collection.apply()\n * @see Collection.inject()\n */\nCollection.prototype.raw = function raw(key, default_value, strict) {\n\n if (this.has(key)) {\n return this._container[key];\n }\n\n if (strict){\n throw new Error('Identifier ' + key + ' is not defined');\n }\n\n return default_value;\n};\n\n/**\n * Call a function with dependencies injection.\n *\n * Unlike `Collection.invoke()`,\n * the raw value of each dependency is passed to `fn`.\n *\n * @example\n * items.set('multiply', function(a, b) {\n * return a * b;\n * });\n *\n * // returns 8\n * items.inject('multiply', function(multiply) {\n * return multiply(2, 4);\n * });\n *\n * // or equivalent\n *\n * // return 8\n * items.apply(function() {\n * return this.multiply(2, 4);\n * });\n *\n * // returns 8\n * items.raw('multiply')(2, 4);\n *\n * @param {string|array|function} deps Dependencies to inject as arguments of\n * the function (`fn`).\n * Or only a function that receives\n * in first argument\n * the container of `Collection` instance.\n *\n * @param {function} [fn] Function to call. Dependencies are passed as arguments\n * in the order of declaration.\n * If `deps` is a function, this argument is ignored.\n *\n * @return {mixed} The value returned by the given function.\n *\n * @throws {TypeError} If a key is not a `string`.\n *\n * @see Collection.invoke()\n * @see Collection.raw()\n * @see Collection.apply()\n */\nCollection.prototype.inject = function inject(deps, fn) {\n\n if (Array.isArray(deps)) {\n\n for(var i in deps) {\n deps[i] = this.raw(deps[i]);\n }\n\n return fn.apply(null, deps);\n }\n\n return typeof deps === 'function' ? deps(this._container) : fn(this.raw(deps));\n};\n\n/**\n * Call a function with dependencies injection.\n *\n * Unlike `Collection.inject()`,\n * the returned value of each dependency is passed to `fn`.\n *\n * @example\n * items.addAll({\n * name: 'Nico',\n * hello: function(){\n * return 'Hello ' + this.name;\n * }\n * });\n *\n * items.invoke('hello', function(hello) {\n *\n * // Hello Nico\n * console.log(hello);\n * });\n *\n * @param {string|array|function} deps Dependencies to call and inject the\n * returned value as arguments of\n * the function (`fn`).\n * Or only a function that receives\n * in first argument\n * the container of `Collection` instance.\n *\n * @param {function} [fn] Function to call. Dependencies are passed as arguments\n * in the order of declaration.\n * If `deps` is a function, this argument is ignored.\n *\n * @return {mixed} The value returned by the given function.\n *\n * @throws {TypeError} If a key is not a `string`.\n *\n * @see Collection.get()\n * @see Collection.inject()\n * @see Collection.apply()\n */\nCollection.prototype.invoke = function invoke(deps, fn) {\n\n if (Array.isArray(deps)) {\n\n for(var i in deps) {\n deps[i] = this.get(deps[i]);\n }\n\n return fn.apply(null, deps);\n }\n\n return typeof deps === 'function' ? deps(this._container) : fn(this.get(deps));\n};\n\n/**\n * Calls a given function by binding the scope (`this`) to the container\n * (`Collection._container`).\n *\n * The javascript function implements natively the methods `call()` and `apply()`.\n *\n * It is possible that `bindable` argument is not a function,\n * in this case it is necessary that the object implements\n * `call(container)` and `apply(container, args)`, then handles the logic.\n *\n * @example\n * var fn = function() {\n * return this === items._container;\n * };\n *\n * // true\n * console.log(items.apply(fn));\n *\n * @param {function|object} bindable Function or object to call and whose\n * the scope (`this`) will bind to container.\n *\n * @param {...mixed} [arguments] Zero, one or more arguments\n * passed to `bindable`.\n *\n * @return {mixed} The value returned by `bindable`.\n *\n * @see Collection.inject()\n * @see Collection.invoke()\n */\nCollection.prototype.apply = function apply(bindable) {\n\n if(arguments.length > 1) {\n\n var args = Array.prototype.slice.call(arguments, 1);\n\n return bindable.apply(this._container, args);\n }\n\n return bindable.call(this._container);\n};\n\n\n/**\n * Wrap a value.\n * Useful to avoid calling a function in the implementation\n * of a _provider_ or a _factory_.\n *\n * @param {mixed} value The value to wrap.\n * @return {function} `value` wrapped by a function\n *\n * @see Collection.singleton()\n * @see Collection.provider()\n * @see Collection.factory()\n */\nCollection.prototype.wrap = function wrap(value) {\n\n return function wrapper() {\n return value;\n };\n};\n\n/**\n * Create a singleton (function shared).\n *\n * @param {string} key The key (function identifier).\n *\n * @param {function} fn The function, executed once,\n * after the value is returned when is again called.\n *\n * @return {Collection} The current ìnstance.\n *\n * @throws {TypeError} If `key` is not a `string` or if `fn` is not a `function`.\n *\n * @see Collection.provider()\n * @see Collection.factory()\n * @see Collection.wrap()\n */\nCollection.prototype.singleton = function singleton(key, fn) {\n\n var ret;\n var shared;\n\n if (typeof key !== 'string') {\n throw new TypeError(\n 'Argument #1 passed to Collection.singleton() must be a string ' +\n 'identifier'\n );\n }\n\n if (typeof fn !== 'function') {\n throw new TypeError(\n 'Argument #2 passed to Collection.singleton() must be a function'\n );\n }\n\n this._container[key] = function() {\n\n if (!ret) {\n ret = true;\n shared = arguments.length ? fn.apply(null, arguments) : fn();\n }\n\n return shared;\n };\n\n return this;\n};\n\n/**\n * Create a _provider_ that supports dependencies injection.\n * When the item `key` is called,\n * it calls the function `fn` by passing dependencies `deps`.\n *\n * This method defines a function that returns the result\n * of [Collection.inject(deps, fn)](#inject).\n *\n * @example\n * items.set('hello', function() {\n * return 'Hello World!';\n * });\n *\n * items.provider('sayHello', ['hello'], function(hello) {\n * return hello();\n * });\n *\n * // 'Hello World!'\n * items.get('sayHello');\n *\n * // or with the scope in any injector\n * items.apply(function() {\n *\n * // 'Hello World!'\n * console.log(this.sayHello);\n * });\n *\n * @param {string} key The key (provider identifier).\n * @param {string|array|function} deps See [Collection.inject()](#inject).\n * @param {function} [fn] See [Collection.inject()](#inject).\n *\n * @return {Collection} The current ìnstance.\n *\n * @throws {TypeError} If `key` is not a `string`\n * or if a given key in `deps` is not a `string`.\n *\n * @see Collection.inject()\n * @see Collection.factory()\n * @see Collection.singleton()\n * @see Collection.wrap()\n */\nCollection.prototype.provider = function provider(key, deps, fn) {\n\n var _this = this;\n var ret;\n var shared;\n\n if (typeof key !== 'string') {\n throw new TypeError(\n 'Argument #1 passed to Collection.provider() must be a string ' +\n 'identifier'\n );\n }\n\n this._container[key] = function() {\n\n if(!ret) {\n ret = true;\n shared = _this.inject(deps, fn);\n }\n\n return shared;\n };\n\n return this;\n};\n\n/**\n * Create a _factory_ that supports dependencies injection.\n * When the item `key` is called,\n * it calls the function `fn` by passing dependencies `deps`.\n *\n * This method defines a function that returns the result\n * of [Collection.invoke(deps, fn)](#invoke).\n *\n * @example\n * items.set('hello', function() {\n * return 'Hello World!';\n * });\n *\n * items.factory('sayHello', ['hello'], function(hello) {\n * return hello;\n * });\n *\n * // 'Hello World!'\n * items.get('sayHello');\n *\n * // or with the scope in any injector\n * items.apply(function() {\n *\n * // 'Hello World!'\n * console.log(this.sayHello);\n * });\n *\n * @param {string} key The key (factory identifier).\n * @param {string|array|function} deps See `Collection.invoke()`.\n * @param {function} [fn] See `Collection.invoke()`.\n *\n * @return {Collection} The current ìnstance.\n *\n * @throws {TypeError} If `key` is not a `string`\n * or if a given key in `deps` is not a `string`.\n *\n * @see Collection.invoke()\n * @see Collection.provider()\n * @see Collection.singleton()\n * @see Collection.wrap()\n */\nCollection.prototype.factory = function factory(key, deps, fn) {\n\n var _this = this;\n var ret;\n var shared;\n\n if (typeof key !== 'string') {\n throw new TypeError(\n 'Argument #1 passed to Collection.factory() must be a string ' +\n 'identifier'\n );\n }\n\n this._container[key] = function() {\n\n if(!ret) {\n ret = true;\n shared = _this.invoke(deps, fn);\n }\n\n return shared;\n };\n\n return this;\n};\n\n\nmodule.exports = Collection;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/collection.js\n ** module id = 2\n ** module chunks = 0\n **/","var map = {\n\t\"./collection\": 2,\n\t\"./collection.js\": 2,\n\t\"./index\": 1,\n\t\"./index.js\": 1,\n\t\"./utils\": 4,\n\t\"./utils.js\": 4\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\treturn map[req] || (function() { throw new Error(\"Cannot find module '\" + req + \"'.\") }());\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src ^\\.\\/.*$\n ** module id = 3\n ** module chunks = 0\n **/","/**\n * This file is part of Noder.io.\n *\n * (c) Nicolas Tallefourtane \n *\n * For the full copyright and license information, please view\n * the LICENSE file that was distributed with this source code\n * or visit http://noder.io.\n *\n * @author Nicolas Tallefourtane \n */\n\n'use strict';\n\n/**\n * Merge object `b` in object `a`.\n *\n * var a = { foo: 'bar' }\n * , b = { bar: 'baz' };\n *\n * utils.merge(a, b);\n * // => { foo: 'bar', bar: 'baz' }\n *\n * @param {Object} a Object that receives the value of `b`.\n * @param {Object} b Object to merge in `a`.\n * @return {Object} `a` merged\n */\nmodule.exports.merge = function merge(a, b) {\n\n if (a && b) {\n for (var key in b) {\n a[key] = b[key];\n }\n }\n\n return a;\n};\n\n/**\n * Merge recursive\n * @param {object|array} obj Object that receives the value of `from`\n * @param {...object|array} from One or more objects to merge in `obj`.\n * @return {Object} `obj` merged\n */\nmodule.exports.mergeRecursive = function mergeRecursive(obj) {\n\n var argLen = arguments.length;\n\n if (argLen < 2) {\n throw new Error('There should be at least 2 arguments passed to utils.mergeRecursive()');\n }\n\n for (var i = 1; i < argLen; i++) {\n for (var p in arguments[i]) {\n if (obj[p] && typeof obj[p] === 'object') {\n obj[p] = this.mergeRecursive(obj[p], arguments[i][p]);\n } else {\n obj[p] = arguments[i][p];\n }\n }\n }\n return obj;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils.js\n ** module id = 4\n ** module chunks = 0\n **/"],"sourceRoot":"","file":"noder-dev.js"} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 55bc6c01cb38d9918afb","webpack:///./src/browser.js","webpack:///./src/index.js","webpack:///./src/collection.js","webpack:///./src ^\\.\\/.*$","webpack:///./src/utils.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,wC;;;;;;;;;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,sD;;;;;;;;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAU;AACV;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA,WAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA,2CAA0C,aAAa;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA,6CAA4C,aAAa;AACzD;AACA;AACA;AACA;AACA,aAAY,WAAW;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAY,MAAM;AAClB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAY,uBAAuB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA,aAAY,MAAM;AAClB;AACA,aAAY,UAAU;AACtB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,8DAA6D;AAC7D,oCAAmC;AACnC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAG;;AAEH;;AAEA;;AAEA,IAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,sBAAsB;AACjC,YAAW,SAAS;AACpB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,sBAAsB;AACjC,YAAW,SAAS;AACpB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,sBAAsB;AACjC,YAAW,SAAS;AACpB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,sBAAsB;AACjC,YAAW,SAAS;AACpB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA,YAAW,SAAS;AACpB;AACA;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA,YAAW,gBAAgB;AAC3B,YAAW,SAAS;AACpB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAY,MAAM;AAClB,aAAY,SAAS;AACrB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,gBAAgB;AAC3B;AACA;AACA;AACA,YAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAY,MAAM;AAClB;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAY,OAAO;AACnB,aAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;;;AAGA;;;;;;;;;;AC1gBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,KAAK;AACjB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,WAAW;AACvB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,MAAM;AACjB,aAAY,WAAW;AACvB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA,YAAW,OAAO;AAClB;AACA,aAAY,WAAW;AACvB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA,aAAY,WAAW;AACvB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA,YAAW,MAAM;AACjB;AACA,YAAW,KAAK;AAChB;AACA;AACA;AACA,aAAY,WAAW;AACvB;AACA,aAAY,UAAU;AACtB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA,YAAW,KAAK;AAChB;AACA;AACA;AACA,aAAY,WAAW;AACvB;AACA,aAAY,UAAU;AACtB,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAY,OAAO;AACnB,YAAW,UAAU;AACrB;AACA,aAAY,WAAW;AACvB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA,YAAW,MAAM;AACjB;AACA;AACA;AACA,YAAW,KAAK;AAChB;AACA;AACA;AACA,aAAY,MAAM;AAClB,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA,aAAY,UAAU;AACtB,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA,OAAM;AACN;AACA,YAAW,OAAO;AAClB;AACA,YAAW,MAAM;AACjB;AACA;AACA;AACA,YAAW,KAAK;AAChB;AACA;AACA;AACA,aAAY,MAAM;AAClB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA,aAAY,UAAU;AACtB;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA,YAAW,sBAAsB;AACjC;AACA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA;AACA;AACA,aAAY,MAAM;AAClB;AACA,aAAY,UAAU;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA,YAAW,sBAAsB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA;AACA;AACA,aAAY,MAAM;AAClB;AACA,aAAY,UAAU;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAY,gBAAgB;AAC5B;AACA;AACA,YAAW,SAAS;AACpB;AACA;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,aAAY,MAAM;AAClB,aAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA,YAAW,SAAS;AACpB;AACA;AACA,aAAY,WAAW;AACvB;AACA,aAAY,UAAU;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA,YAAW,OAAO;AAClB,YAAW,sBAAsB;AACjC,YAAW,SAAS;AACpB;AACA,aAAY,WAAW;AACvB;AACA,aAAY,UAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA,OAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAM;AACN;AACA,YAAW,OAAO;AAClB,YAAW,sBAAsB;AACjC,YAAW,SAAS;AACpB;AACA,aAAY,WAAW;AACvB;AACA,aAAY,UAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA,6B;;;;;;;;;AC3xBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAiC,uDAAuD;AACxF;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,iBAAgB;AAChB,iBAAgB;AAChB;AACA;AACA,eAAc;AACd;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAW,aAAa;AACxB,YAAW,gBAAgB;AAC3B,aAAY,OAAO;AACnB;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,kBAAiB,YAAY;AAC7B;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA,G","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 55bc6c01cb38d9918afb\n **/","/**\n * This file is part of Noder.io.\n *\n * (c) Nicolas Tallefourtane \n *\n * For the full copyright and license information, please view\n * the LICENSE file that was distributed with this source code\n * or visit http://noder.io.\n *\n * @author Nicolas Tallefourtane \n */\n\n'use strict';\n\n/*----------------------------------------------------------------------------*\\\n Polyfill\n\\*----------------------------------------------------------------------------*/\n\nif(!Array.isArray) {\n\n var toString = Object.prototype.toString();\n\n Array.isArray = function isArray(array) {\n\n if (toString.call(array) === '[object Array]') {\n return true;\n } else if ( typeof array.slice === 'function' &&\n typeof array.length === 'number') {\n return true;\n }\n\n return false;\n };\n}\n\n// expose\nwindow.noder = require('./index');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/browser.js\n ** module id = 0\n ** module chunks = 0\n **/","/**\n * This file is part of Noder.io.\n *\n * (c) Nicolas Tallefourtane \n *\n * For the full copyright and license information, please view\n * the LICENSE file that was distributed with this source code\n * or visit http://noder.io.\n *\n * @author Nicolas Tallefourtane \n */\n\n'use strict';\n\nvar Collection = require('./collection');\n\n// modules loaded\nvar loaded = {};\n\n/**\n * `Noder` constructor.\n *\n * The `Noder` instance is created when the first usage of `require('noder.io')`,\n * then the same object (reference) is returned by `require('noder.io')` in the next usages.\n *\n * @example\n * // file: a.js\n * var noder = require('noder.io');\n *\n * // true\n * console.log(typeof noder === 'object');\n *\n * // true\n * console.log(noder instanceof noder.Noder);\n *\n * noder.set('hello', '-> Hello from a.js file.');\n *\n * // file: b.js\n * var noder = require('noder.io');\n *\n * // -> Hello from a.js file.\n * console.log(noder.get('hello'));\n *\n * @constructor\n *\n * @see Noder.Noder\n */\nfunction Noder() {\n\n this.$di = new Noder.prototype.$di();\n\n this.$di.addAll({\n '$api' : this,\n '$di' : this.$di,\n '$container' : this.$di._container,\n '$invoke' : this.$wrap(this.$invoke),\n '$inject' : this.$wrap(this.$inject),\n '$provider' : this.$wrap(this.$provider),\n '$factory' : this.$wrap(this.$factory),\n '$singleton' : this.$wrap(this.$singleton),\n '$apply' : this.$wrap(this.$apply),\n '$wrap' : this.$wrap(this.$wrap)\n });\n}\n\n/**\n * `Noder` constructor.\n * For creating a new instance of `Noder`.\n *\n * @example\n * var api = new noder.Noder();\n *\n * @constructor\n * @type {function}\n */\nNoder.prototype.Noder = Noder;\n\n/**\n * IOC container.\n *\n * See [Collection API doc](collection.html).\n *\n * @example\n * noser.$di.set('name', Nico);\n *\n * var hello = noder.$di.apply(function() {\n * return 'Hello ' + this.name;\n * });\n *\n * @type {Collection}\n *\n * @see Noder.$invoke()\n * @see Noder.$inject()\n * @see Noder.$provider()\n * @see Noder.$factory()\n * @see Noder.$singleton()\n * @see Noder.$apply()\n * @see Noder.$wrap()\n */\nNoder.prototype.$di = Collection;\n\n/**\n * `Collection` constructor.\n * For creating a new instance of `Collection`.\n *\n * @example\n * var collection = new noder.Collection();\n *\n * collection.set('keyName', 'any value');\n *\n * // any value\n * console.log(collection.get('keyName'));\n *\n *\n * @constructor\n *\n * @param {object} [values] (Optional) values to add in the collection.\n * ```js\n * var collection = new noder.Collection({'foo': 'bar'});\n *\n * // display \"bar\"\n * console.log(collection.get('foo'));\n * ```\n *\n * @see Noder.createCollection()\n * @see Noder.Noder\n */\nNoder.prototype.Collection = Collection;\n\n/**\n * Create a collection container.\n *\n * @example\n * var collection = noder.createCollection();\n *\n * // true\n * console.log(collection instanceof noder.Collection);\n *\n * collection.set('keyName', 'any value');\n *\n * // any value\n * console.log(collection.get('keyName'));\n *\n * @param {object} [values] Optional values to add in the new collection.\n * ```js\n * var collection = noder.createCollection({'foo': 'bar'});\n *\n * // display \"bar\"\n * console.log(collection.get('foo'));\n * ```\n * @return {Collection} The new `Collection` instance\n *\n * @see Noder.Collection\n * @see Noder.createNoder()\n */\nNoder.prototype.createCollection = function createCollection(values) {\n\n if(values) {\n return new this.Collection(values);\n }\n\n return new this.Collection();\n};\n\n/**\n * Create a new `Noder` instance.\n *\n * @example\n * var api = noder.createNoder();\n *\n * // true\n * console.log(api instanceof noder.Noder);\n *\n * @return {Noder} The new `Noder` instance\n */\nNoder.prototype.createNoder = function createNoder() {\n\n return new this.Noder();\n};\n\n/**\n * Use a noder plugin.\n * A plugin is initialized by the method `__noder()`.\n *\n * See also [plugins](/guide/plugins.html) in the guide.\n *\n * @example\n * // example-plugin.js *\n * module.exports.__noder = examplePlugin(noder, arg1, arg2) {\n *\n * noder.$di.set('foo', arg1 + ' and ' + arg2);\n *\n * return noder;\n * };\n *\n * // app.js\n * var noder = require('noder.io').createNoder();\n * var examplePlugin = require('./example-plugin');\n *\n * noder.use(examplePlugin, 'any value 1', 'any value 2');\n *\n * // displays: 'any value 1 and any value 2'\n * console.log(noder.$di.get('foo'));\n *\n * @param {string|object|function} noderPlugin A noder plugin.\n * If `noderPlugin` is:\n *\n * * `string`: the plugin is loaded with `require`\n * and called by passing the current instance of `noder` like\n *\n * ```js\n * require(noderPlugin).__noder(noder [, optional argument, ...]);\n * ```\n * * `object` or `function`: the method `__noder()` is called by passing\n * the current instance of `noder` like\n *\n * ```js\n * noderPlugin.__noder(noder [, optional argument, ...]);\n * ```\n *\n * @param {...mixed} [arguments] Zero, one or several arguments passed to plugin.\n *\n * @return {Noder} The current `Noder` instance.\n *\n * @throws {TypeError} If the plugin has not the method [__noder()](/guide/plugins.html).\n */\nNoder.prototype.use = function use(noderPlugin) {\n\n var initPlugin = function(plugin, args) {\n\n if(typeof plugin.__noder != 'function') {\n throw new TypeError(\n 'Argument #1 passed to Noder.use() is not a valid plugin for Noder.io.' +\n 'A plugin must implement a method named `__noder()` that is used for ' +\n 'initialization. Example: ' +\n '`module.exports.__noder = function MyPlugin(noder) {\\n ' +\n '// here, the bootstrap\\n};`' +\n '\\n\\nAPI doc: http://noder.io/api/noder.html#use'\n );\n }\n\n plugin = plugin.__noder;\n\n args.length > 1 ?\n plugin.apply(null,\n Array.prototype.concat.apply(\n [this], Array.prototype.slice.call(args, 1)\n )\n )\n : plugin(this);\n\n }.bind(this);\n\n if(typeof noderPlugin == 'string') {\n\n initPlugin(require(noderPlugin), arguments);\n\n }else{\n\n initPlugin(noderPlugin, arguments);\n }\n\n return this;\n};\n\n/**\n * Shortcut of `noder.$di.invoke()`.\n *\n * Call a function with dependencies injection.\n *\n * Unlike `noder.$invoke()`,\n * the returned value of each dependency is passed to `fn`.\n *\n * @param {string|array|function} deps See [Collection.invoke()](collection.html#invoke).\n * @param {function} [fn] See [Collection.invoke()](collection.html#invoke).\n *\n * @return {mixed} The result of `fn`.\n *\n * @see Collection.invoke()\n * @see Noder.$inject()\n */\nNoder.prototype.$invoke = function $invoke(deps, fn) {\n\n return this.$di.invoke(deps, fn);\n};\n\n/**\n * Shortcut of `noder.$di.inject()`.\n *\n * Call a function with dependencies injection.\n *\n * Unlike `noder.$invoke()`,\n * the raw value of each dependency is passed to `fn`.\n *\n * @param {string|array|function} deps See [Collection.inject()](collection.html#inject).\n * @param {function} [fn] See [Collection.inject()](collection.html#inject).\n *\n * @return {mixed} The result of `fn`.\n *\n * @see Collection.inject()\n * @see Noder.$invoke()\n */\nNoder.prototype.$inject = function $inject(deps, fn) {\n\n return this.$di.inject(deps, fn);\n};\n\n/**\n * Shortcut of `noder.$di.provider()`.\n *\n * Create a `provider` that supports dependencies injection.\n * When the item `key` is called,\n * it calls the function `fn` by passing dependencies `deps`.\n *\n * This method defines a function that returns the result\n * of `noder.$di.inject(deps, fn)`.\n *\n * @param {string} key The key (provider identifier).\n * @param {string|array|function} deps See [Noder.$inject()](#$inject).\n * @param {function} [fn] See [Noder.$inject()](#$inject).\n *\n * @return {Noder} The current `Noder` instance.\n *\n * @see Collection.provider()\n * @see Noder.$inject()\n * @see Noder.$factory()\n * @see Noder.$singleton()\n * @see Noder.$wrap()\n */\nNoder.prototype.$provider = function $provider(key, deps, fn) {\n\n this.$di.provider(key, deps, fn);\n\n return this;\n};\n\n/**\n * Shortcut of `noder.$di.factory()`.\n *\n * Create a `factory` that supports dependencies injection.\n * When the item `key` is called,\n * it calls the function `fn` by passing dependencies `deps`.\n *\n * This method defines a function that returns the result\n * of `noder.$di.invoke(deps, fn)`.\n *\n * @param {string} key The key (factory identifier).\n * @param {string|array|function} deps See [Noder.$invoke()](#$invoke).\n * @param {function} [fn] See [Noder.$invoke()](#$invoke).\n *\n * @return {Noder} The current `Noder` instance.\n *\n * @see Collection.factory()\n * @see Noder.$invoke()\n * @see Noder.$provider()\n * @see Noder.$singleton()\n * @see Noder.$wrap()\n */\nNoder.prototype.$factory = function $factory(key, deps, fn) {\n\n this.$di.factory(key, deps, fn);\n\n return this;\n};\n\n/**\n * Shortcut of `noder.$di.singleton()`.\n *\n * Create a singleton (function shared).\n *\n * @param {string} key The key (function identifier).\n *\n * @param {function} fn The function, executed once,\n * after the value is returned when is again called.\n *\n * @return {Noder} The current `Noder` instance.\n *\n * @see Collection.singleton()\n * @see Noder.$provider()\n * @see Noder.$factory()\n * @see Noder.$wrap()\n */\nNoder.prototype.$singleton = function $singleton(key, fn) {\n\n this.$di.singleton(key, fn);\n\n return this;\n};\n\n/**\n * Shortcut of `noder.$di.apply()`.\n *\n * Calls a given function by binding the scope (`this`) to the `$di` container\n * (`noder.$di._container`).\n *\n * @example\n * noder.set('name', 'Nico');\n *\n * // returns 'Nico'\n * noder.$apply(function() {\n * return this.name;\n * });\n *\n * @param {function|object} bindable See [Collection.apply()](collection.html#apply).\n * @param {...mixed} [arguments] Zero, one or more arguments passed to `bindable`.\n *\n * @return {mixed} The value returned by `bindable`.\n *\n * @see Collection.apply()\n * @see Noder.inject()\n */\nNoder.prototype.$apply = function $apply(bindable) {\n\n return this.$di.apply(bindable);\n};\n\n/**\n * Shortcut of `noder.$di.wrap()`.\n *\n * Wrap a value.\n * Useful to avoid calling a function in the implementation\n * of a _provider_ or a _factory_.\n *\n * @param {mixed} value The value to wrap.\n * @return {function} `value` wrapped by a function.\n *\n * @see Collection.wrap()\n */\nNoder.prototype.$wrap = function $wrap(value) {\n\n return this.$di.wrap(value);\n};\n\n/**\n * Lazy `require()`, register a new lazy loadable property\n * whose the value will be assigned on the fly with `require()` only when it is used.\n *\n * The property configuration is :\n * * enumerable: true,\n * * configurable: false,\n * * writable: false\n *\n * @example\n * // Register `markdown` property\n * // Note: `marked` module is not loaded\n * noder.$require('markdown', 'marked');\n *\n * // Now load the `marked` module in the `markdown` property\n * noder.markdown;\n *\n * @param {string|function} property The property name\n * or `required` value if the `required`\n * argument is not provided (shortcut).\n *\n * @param {string|function} [required] The module name or the JS file path\n * required to set the property value.\n * Or a custom loader handler\n * via a given function.\n *\n * Note:\n * * The `required` argument is passed to the function `require()`.\n * * The `required` item is only loaded the first time (singleton).\n *\n * @return {Noder} The current `Noder` instance.\n */\nNoder.prototype.$require = function $require(property, required) {\n\n Object.defineProperty(this, property, {\n\n enumerable : true,\n configurable : false,\n\n get: function() {\n\n if (this.$require.isLoaded(property)) {\n return loaded[property];\n }\n\n if(typeof required === 'undefined') {\n required = property;\n }\n\n loaded[property] = (typeof required === 'function' ?\n required.call(this._container) : require(required));\n\n return loaded[property];\n },\n\n set: function() {\n throw new Error(\n '\"' + property +'\" property is not writable because is a placeholder ' +\n 'of a property of a lazy loading module.'\n );\n }\n });\n\n return this;\n};\n\n/**\n * Check if a given module is loaded.\n *\n * @example\n * noder.$require('express');\n *\n * // false\n * console.log(noder.$require.isLoaded('express'));\n *\n * var express = noder.express;\n *\n * // true\n * console.log(noder.$require.isLoaded('express'));\n *\n * @param {string} property The property name.\n * @return {bool} `true` if the given module is loaded, `false` otherwise.\n * @see Noder.$require()\n */\nNoder.prototype.$require.isLoaded = function isLoaded(property) {\n return (undefined !== loaded[property]);\n};\n\n\nmodule.exports = new Noder();\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/index.js\n ** module id = 1\n ** module chunks = 0\n **/","/**\n * This file is part of Noder.io.\n *\n * (c) Nicolas Tallefourtane \n *\n * For the full copyright and license information, please view\n * the LICENSE file that was distributed with this source code\n * or visit http://noder.io.\n *\n * @author Nicolas Tallefourtane \n */\n\n'use strict';\n\nvar utils = require('./utils');\n\n/**\n * Create a new collection.\n *\n * @constructor\n *\n * @example\n * var items = new Collection();\n *\n * @param {object} [values] Values to add in the collection.\n * @throws {TypeError} If the arguments `values` is provided is not an `object`.\n */\nfunction Collection(values) {\n\n /**\n * Items container.\n * All values of the collection are stored in the container.\n * @type {object}\n */\n this._container = values || {};\n\n if (values && typeof values !== 'object') {\n throw new TypeError(\n 'Argument #1 passed to Collection must be an object'\n );\n }\n}\n\n/**\n * Get all keys of the collection.\n *\n * @example\n * items.keys();\n *\n * @return {array} An array of keys.\n */\nCollection.prototype.keys = function keys() {\n return Object.keys(this._container);\n};\n\n/**\n * Checks if an item exists\n *\n * @example\n * items.set('keyName', 'any value');\n *\n * if(items.has('keyName')) {\n * console.log('has `keyName`');\n * }\n *\n * @param {string} key The key of the item to check.\n * @return {bool} `true` if exists, `false` otherwise.\n * @throws {TypeError} If `key` is not a `string`.\n */\nCollection.prototype.has = function has(key) {\n\n if (typeof key !== 'string') {\n throw new TypeError(\n 'Argument #1 passed to Collection.has() must be a string identifier, ' +\n Object.prototype.toString(key) + ' given'\n );\n }\n\n return (key in this._container === true);\n};\n\n/**\n * Remove an item.\n *\n * @example\n * items.set('keyName', 'any value');\n *\n * // true\n * console.log(items.has('keyName'));\n *\n * items.remove('keyName');\n *\n * // false\n * console.log(items.has('keyName'));\n *\n * @param {string} key The key of item to remove.\n * @return {Collection} The current ìnstance.\n * @throws {TypeError} If `key` is not a `string`.\n */\nCollection.prototype.remove = function remove(key) {\n\n if (typeof key !== 'string') {\n throw new TypeError(\n 'Argument #1 passed to Collection.remove() must be a string ' +\n 'identifier'\n );\n }\n\n delete this._container[key];\n\n return this;\n};\n\n/**\n * Set an item.\n *\n * @example\n * items.set('hello', 'Hello World!');\n *\n * // Hello World!\n * console.log(items.get('hello'));\n *\n * @param {string} key Key name.\n * @param {mixed} value The value.\n * @return {Collection} The current ìnstance.\n * @throws {TypeError} If `key` is not a `string`.\n */\nCollection.prototype.set = function set(key, value) {\n\n if (typeof key !== 'string') {\n throw new TypeError(\n 'Argument #1 passed to Collection.set() must be a string identifier'\n );\n }\n\n this._container[key] = value;\n\n return this;\n};\n\n/**\n * Set all items of the collection.\n * All collection is overwritten by the given set of items.\n *\n * @example\n * items.setAll({\n * a: 'value 1',\n * b: 'value 2',\n * c: 'value 3'\n * });\n *\n * @param {values} values The new values of the collection.\n *\n * @return {Collection} The current ìnstance.\n * @throws {TypeError} If `values` is not an `object`.\n */\nCollection.prototype.setAll = function setAll(values) {\n\n if (typeof values !== 'object') {\n throw new TypeError(\n 'Argument #1 passed to Collection.setAll() must be an object'\n );\n }\n\n this._container = values;\n\n return this;\n};\n\n/**\n * Add all items in the collection.\n *\n * items.addAll({\n * a: 'value 1',\n * b: 'value 2',\n * c: 'value 3'\n * });\n *\n * @param {object} values The values to add.\n * The existing values are overwritten,\n * the other items are preserved.\n *\n * @return {Collection} The current ìnstance.\n * @throws {TypeError} If `values` is not an `object` or if a key is not a `string`.\n */\nCollection.prototype.addAll = function addAll(values) {\n\n if (typeof values !== 'object') {\n throw new TypeError(\n 'Argument #1 passed to Collection.addAll() must be an object'\n );\n }\n\n for (var key in values) {\n this.set(key, values[key]);\n }\n\n return this;\n};\n\n/**\n * Add once an item in the collection.\n * Identical to [Collection.set()](#set) method, except the item is added only\n * if it is not already defined in the collection.\n *\n * @param {string} key The key name.\n *\n * @param {mixed} value The value.\n *\n * @param {bool} [skip_if_exists] Defines the behavior if the given key exists:\n * * if `truthy`, nothing happens and the item already defined is not overwritten\n * * if `falsy` (by default) an `Error` is thrown\n *\n * @return {Collection} The current ìnstance.\n *\n * @throws {TypeError} If `key` is not a `string`.\n *\n * @throws {Error} If an item is already defined\n * with the same `key` and `skip_if_exists` is not `truthy`.\n *\n * @see Collection.addOnceAll()\n * @see Collection.set()\n */\nCollection.prototype.addOnce = function addOnce(key, value, skip_if_exists) {\n\n if (this.has(key)) {\n\n if (skip_if_exists){\n return this;\n }\n\n throw new Error(\n 'Identifier ' + key + ' passed to Collection.addOnce() ' +\n 'is already defined'\n );\n }\n\n return this.set(key, value);\n};\n\n/**\n * Add all items in the collection only if not already defined.\n *\n * @param {object} values Identical to [Collection.addAll()](#addAll) method.\n *\n * @param {bool} [skip_if_exists] Defines the behavior if an item exists:\n * * if `truthy`, nothing happens and the item already defined is not overwritten\n * * if `falsy` (by default) an `Error` is thrown\n *\n * @return {Collection} The current ìnstance.\n *\n * @throws {TypeError} If `values` is not an `object` or if a key is not a `string`.\n * @throws {Error} If an item is already defined and `skip_if_exists` is not `truthy`.\n *\n * @see Collection.addOnce()\n * @see Collection.addAll()\n */\nCollection.prototype.addOnceAll = function addOnceAll(values, skip_if_exists) {\n\n if (typeof values !== 'object') {\n throw new TypeError(\n 'Argument #1 passed to Collection.addOnceAll() must be an object'\n );\n }\n\n for (var key in values) {\n this.addOnce(key, values[key], skip_if_exists);\n }\n\n return this;\n};\n\n/**\n * Merge `values` (recursive) in the collection.\n *\n * @param {object} values Values to merge.\n * @param {...object} [values] Zero, one or several other objects.\n *\n * @return {Collection} The current ìnstance.\n * @throws {TypeError} If `values` is not an `object`.\n */\nCollection.prototype.merge = function merge(values) {\n\n if (typeof values !== 'object') {\n throw new TypeError(\n 'Argument #1 passed to Collection.merge() must be an object'\n );\n }\n\n var args = Array.prototype.concat.apply([this._container], arguments);\n\n this._container = utils.mergeRecursive.apply(utils, args);\n\n return this;\n};\n\n/**\n * Get all items of the collection.\n *\n * @return {object} All items defined in the collection.\n */\nCollection.prototype.getAll = function getAll() {\n\n return this._container;\n};\n\n/**\n * Get an item value.\n *\n * If the item is a function, the fonction is called\n * and `get()` returns the value returned by the function called.\n *\n * If you want the raw value, uses [Collection.raw()](#raw).\n *\n * @example\n * items.addAll({\n * a: 'value of \"a\"',\n * b: function() {\n * 'value of \"b\"'\n * }\n * });\n *\n * // value of \"a\", string\n * console.log(items.get('a'), typeof items.get('a'));\n *\n * // value of \"b\", string\n * console.log(items.get('b'), typeof items.get('b'));\n *\n * // value of \"a\", string\n * console.log(items.raw('a'), typeof items.raw('a'));\n *\n * // [Function], function\n * console.log(items.raw('b'), typeof items.raw('b'));\n *\n * @param {string} key The key of the item\n *\n * @param {mixed} [default_value] The default value if the item\n * does not exist (`default_value` is ignored\n * if `strict` is `truthy`).\n *\n * @param {bool} [strict] If `truthy` and the item does not exist,\n * throws an `Error` (`default_value` is ignored\n * if `strict` is `truthy`).\n *\n * @return {mixed} The item value (if defined).\n * @return {mixed} Returns `default_value` if:\n * * a default value is defined\n * * `strict` is not `truthy`\n * * the item (`key`) does not exist\n *\n * @throws {TypeError} If `key` is not a `string`.\n * @throws {Error} If `strict` is `truthy` and the item does not exist.\n *\n * @see Collection.raw()\n * @see Collection.apply()\n * @see Collection.invoke()\n */\nCollection.prototype.get = function get(key, default_value, strict) {\n\n if (typeof this._container[key] === 'function') {\n return this._container[key]();\n }\n\n if (this.has(key)) {\n return this._container[key];\n }\n\n if (typeof default_value === 'function') {\n return this.raw(key, default_value, strict)();\n }\n\n return this.raw(key, default_value, strict);\n};\n\n/**\n * Get an item.\n *\n * @example\n * items.set('multiply', function(a, b) {\n * return a * b;\n * });\n *\n * var multiply = items.raw('multiply');\n *\n * // returns 8\n * multiply(2, 4);\n *\n * // or directly\n * // returns 8\n * items.raw('multiply')(2, 4);\n *\n * // or equivalent by injection\n *\n * // returns 8\n * items.inject('multiply', function(multiply) {\n * return multiply(2, 4);\n * });\n *\n * // returns 8\n * items.apply(function() {\n * return this.multiply(2, 4);\n * });\n *\n * @param {string} key The key of the item\n *\n * @param {mixed} [default_value] The default value if the item\n * does not exist (`default_value` is ignored\n * if `strict` is `truthy`).\n *\n * @param {bool} [strict] If `truthy` and the item does not exist,\n * throws an `Error` (`default_value` is ignored\n * if `strict` is `truthy`).\n *\n * @return {mixed} The item value (if defined).\n *\n * @return {mixed} Returns `default_value` if:\n * * a default value is defined\n * * `strict` is not `truthy`\n * * the item (`key`) does not exist\n *\n * @throws {TypeError} If `key` is not a `string`.\n *\n * @throws {Error} If `strict` is `truthy` and the item does not exist.\n *\n * @see Collection.get()\n * @see Collection.apply()\n * @see Collection.inject()\n */\nCollection.prototype.raw = function raw(key, default_value, strict) {\n\n if (this.has(key)) {\n return this._container[key];\n }\n\n if (strict){\n throw new Error('Identifier ' + key + ' is not defined');\n }\n\n return default_value;\n};\n\n/**\n * Call a function with dependencies injection.\n *\n * Unlike `Collection.invoke()`,\n * the raw value of each dependency is passed to `fn`.\n *\n * @example\n * items.set('multiply', function(a, b) {\n * return a * b;\n * });\n *\n * // returns 8\n * items.inject('multiply', function(multiply) {\n * return multiply(2, 4);\n * });\n *\n * // or equivalent\n *\n * // return 8\n * items.apply(function() {\n * return this.multiply(2, 4);\n * });\n *\n * // returns 8\n * items.raw('multiply')(2, 4);\n *\n * @param {string|array|function} deps Dependencies to inject as arguments of\n * the function (`fn`).\n * Or only a function that receives\n * in first argument\n * the container of `Collection` instance.\n *\n * @param {function} [fn] Function to call. Dependencies are passed as arguments\n * in the order of declaration.\n * If `deps` is a function, this argument is ignored.\n *\n * @return {mixed} The value returned by the given function.\n *\n * @throws {TypeError} If a key is not a `string`.\n *\n * @see Collection.invoke()\n * @see Collection.raw()\n * @see Collection.apply()\n */\nCollection.prototype.inject = function inject(deps, fn) {\n\n if (Array.isArray(deps)) {\n\n for(var i in deps) {\n deps[i] = this.raw(deps[i]);\n }\n\n return fn.apply(null, deps);\n }\n\n return typeof deps === 'function' ? deps(this._container) : fn(this.raw(deps));\n};\n\n/**\n * Call a function with dependencies injection.\n *\n * Unlike `Collection.inject()`,\n * the returned value of each dependency is passed to `fn`.\n *\n * @example\n * items.addAll({\n * name: 'Nico',\n * hello: function(){\n * return 'Hello ' + this.name;\n * }\n * });\n *\n * items.invoke('hello', function(hello) {\n *\n * // Hello Nico\n * console.log(hello);\n * });\n *\n * @param {string|array|function} deps Dependencies to call and inject the\n * returned value as arguments of\n * the function (`fn`).\n * Or only a function that receives\n * in first argument\n * the container of `Collection` instance.\n *\n * @param {function} [fn] Function to call. Dependencies are passed as arguments\n * in the order of declaration.\n * If `deps` is a function, this argument is ignored.\n *\n * @return {mixed} The value returned by the given function.\n *\n * @throws {TypeError} If a key is not a `string`.\n *\n * @see Collection.get()\n * @see Collection.inject()\n * @see Collection.apply()\n */\nCollection.prototype.invoke = function invoke(deps, fn) {\n\n if (Array.isArray(deps)) {\n\n for(var i in deps) {\n deps[i] = this.get(deps[i]);\n }\n\n return fn.apply(null, deps);\n }\n\n return typeof deps === 'function' ? deps(this._container) : fn(this.get(deps));\n};\n\n/**\n * Calls a given function by binding the scope (`this`) to the container\n * (`Collection._container`).\n *\n * The javascript function implements natively the methods `call()` and `apply()`.\n *\n * It is possible that `bindable` argument is not a function,\n * in this case it is necessary that the object implements\n * `call(container)` and `apply(container, args)`, then handles the logic.\n *\n * @example\n * var fn = function() {\n * return this === items._container;\n * };\n *\n * // true\n * console.log(items.apply(fn));\n *\n * @param {function|object} bindable Function or object to call and whose\n * the scope (`this`) will bind to container.\n *\n * @param {...mixed} [arguments] Zero, one or more arguments\n * passed to `bindable`.\n *\n * @return {mixed} The value returned by `bindable`.\n *\n * @see Collection.inject()\n * @see Collection.invoke()\n */\nCollection.prototype.apply = function apply(bindable) {\n\n if(arguments.length > 1) {\n\n var args = Array.prototype.slice.call(arguments, 1);\n\n return bindable.apply(this._container, args);\n }\n\n return bindable.call(this._container);\n};\n\n\n/**\n * Wrap a value.\n * Useful to avoid calling a function in the implementation\n * of a _provider_ or a _factory_.\n *\n * @param {mixed} value The value to wrap.\n * @return {function} `value` wrapped by a function\n *\n * @see Collection.singleton()\n * @see Collection.provider()\n * @see Collection.factory()\n */\nCollection.prototype.wrap = function wrap(value) {\n\n return function wrapper() {\n return value;\n };\n};\n\n/**\n * Create a singleton (function shared).\n *\n * @param {string} key The key (function identifier).\n *\n * @param {function} fn The function, executed once,\n * after the value is returned when is again called.\n *\n * @return {Collection} The current ìnstance.\n *\n * @throws {TypeError} If `key` is not a `string` or if `fn` is not a `function`.\n *\n * @see Collection.provider()\n * @see Collection.factory()\n * @see Collection.wrap()\n */\nCollection.prototype.singleton = function singleton(key, fn) {\n\n var ret;\n var shared;\n\n if (typeof key !== 'string') {\n throw new TypeError(\n 'Argument #1 passed to Collection.singleton() must be a string ' +\n 'identifier'\n );\n }\n\n if (typeof fn !== 'function') {\n throw new TypeError(\n 'Argument #2 passed to Collection.singleton() must be a function'\n );\n }\n\n this._container[key] = function() {\n\n if (!ret) {\n ret = true;\n shared = arguments.length ? fn.apply(null, arguments) : fn();\n }\n\n return shared;\n };\n\n return this;\n};\n\n/**\n * Create a _provider_ that supports dependencies injection.\n * When the item `key` is called,\n * it calls the function `fn` by passing dependencies `deps`.\n *\n * This method defines a function that returns the result\n * of [Collection.inject(deps, fn)](#inject).\n *\n * @example\n * items.set('hello', function() {\n * return 'Hello World!';\n * });\n *\n * items.provider('sayHello', ['hello'], function(hello) {\n * return hello();\n * });\n *\n * // 'Hello World!'\n * items.get('sayHello');\n *\n * // or with the scope in any injector\n * items.apply(function() {\n *\n * // 'Hello World!'\n * console.log(this.sayHello);\n * });\n *\n * @param {string} key The key (provider identifier).\n * @param {string|array|function} deps See [Collection.inject()](#inject).\n * @param {function} [fn] See [Collection.inject()](#inject).\n *\n * @return {Collection} The current ìnstance.\n *\n * @throws {TypeError} If `key` is not a `string`\n * or if a given key in `deps` is not a `string`.\n *\n * @see Collection.inject()\n * @see Collection.factory()\n * @see Collection.singleton()\n * @see Collection.wrap()\n */\nCollection.prototype.provider = function provider(key, deps, fn) {\n\n var _this = this;\n var ret;\n var shared;\n\n if (typeof key !== 'string') {\n throw new TypeError(\n 'Argument #1 passed to Collection.provider() must be a string ' +\n 'identifier'\n );\n }\n\n this._container[key] = function() {\n\n if(!ret) {\n ret = true;\n shared = _this.inject(deps, fn);\n }\n\n return shared;\n };\n\n return this;\n};\n\n/**\n * Create a _factory_ that supports dependencies injection.\n * When the item `key` is called,\n * it calls the function `fn` by passing dependencies `deps`.\n *\n * This method defines a function that returns the result\n * of [Collection.invoke(deps, fn)](#invoke).\n *\n * @example\n * items.set('hello', function() {\n * return 'Hello World!';\n * });\n *\n * items.factory('sayHello', ['hello'], function(hello) {\n * return hello;\n * });\n *\n * // 'Hello World!'\n * items.get('sayHello');\n *\n * // or with the scope in any injector\n * items.apply(function() {\n *\n * // 'Hello World!'\n * console.log(this.sayHello);\n * });\n *\n * @param {string} key The key (factory identifier).\n * @param {string|array|function} deps See `Collection.invoke()`.\n * @param {function} [fn] See `Collection.invoke()`.\n *\n * @return {Collection} The current ìnstance.\n *\n * @throws {TypeError} If `key` is not a `string`\n * or if a given key in `deps` is not a `string`.\n *\n * @see Collection.invoke()\n * @see Collection.provider()\n * @see Collection.singleton()\n * @see Collection.wrap()\n */\nCollection.prototype.factory = function factory(key, deps, fn) {\n\n var _this = this;\n var ret;\n var shared;\n\n if (typeof key !== 'string') {\n throw new TypeError(\n 'Argument #1 passed to Collection.factory() must be a string ' +\n 'identifier'\n );\n }\n\n this._container[key] = function() {\n\n if(!ret) {\n ret = true;\n shared = _this.invoke(deps, fn);\n }\n\n return shared;\n };\n\n return this;\n};\n\n\nmodule.exports = Collection;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/collection.js\n ** module id = 2\n ** module chunks = 0\n **/","var map = {\n\t\"./collection\": 2,\n\t\"./collection.js\": 2,\n\t\"./index\": 1,\n\t\"./index.js\": 1,\n\t\"./utils\": 4,\n\t\"./utils.js\": 4\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\treturn map[req] || (function() { throw new Error(\"Cannot find module '\" + req + \"'.\") }());\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src ^\\.\\/.*$\n ** module id = 3\n ** module chunks = 0\n **/","/**\n * This file is part of Noder.io.\n *\n * (c) Nicolas Tallefourtane \n *\n * For the full copyright and license information, please view\n * the LICENSE file that was distributed with this source code\n * or visit http://noder.io.\n *\n * @author Nicolas Tallefourtane \n */\n\n'use strict';\n\n/**\n * Merge object `b` in object `a`.\n *\n * var a = { foo: 'bar' }\n * , b = { bar: 'baz' };\n *\n * utils.merge(a, b);\n * // => { foo: 'bar', bar: 'baz' }\n *\n * @param {Object} a Object that receives the value of `b`.\n * @param {Object} b Object to merge in `a`.\n * @return {Object} `a` merged\n */\nmodule.exports.merge = function merge(a, b) {\n\n if (a && b) {\n for (var key in b) {\n a[key] = b[key];\n }\n }\n\n return a;\n};\n\n/**\n * Merge recursive\n * @param {object|array} obj Object that receives the value of `from`\n * @param {...object|array} from One or more objects to merge in `obj`.\n * @return {Object} `obj` merged\n */\nmodule.exports.mergeRecursive = function mergeRecursive(obj) {\n\n var argLen = arguments.length;\n\n if (argLen < 2) {\n throw new Error('There should be at least 2 arguments passed to utils.mergeRecursive()');\n }\n\n for (var i = 1; i < argLen; i++) {\n for (var p in arguments[i]) {\n if (obj[p] && typeof obj[p] === 'object') {\n obj[p] = this.mergeRecursive(obj[p], arguments[i][p]);\n } else {\n obj[p] = arguments[i][p];\n }\n }\n }\n return obj;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils.js\n ** module id = 4\n ** module chunks = 0\n **/"],"sourceRoot":"","file":"noder-dev.js"} \ No newline at end of file diff --git a/browser/noder.js b/browser/noder.js index fb1be88..d1e75b0 100644 --- a/browser/noder.js +++ b/browser/noder.js @@ -1,2 +1,2 @@ -!function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";/*! Noder.io | (c) 2014 Nicolas Tallefourtane | http://noder.io */ -if(!Array.isArray){var n=Object.prototype.toString();Array.isArray=function(t){return"[object Array]"===n.call(t)?!0:"function"==typeof t.slice&&"number"==typeof t.length?!0:!1}}window.noder=r(2)},function(t,e,r){"use strict";function n(t){if(this._container=t||{},t&&"object"!=typeof t)throw new TypeError("Argument #1 passed to Collection must be an object")}var o=r(3);n.prototype.keys=function(){return Object.keys(this._container)},n.prototype.has=function(t){if("string"!=typeof t)throw new TypeError("Argument #1 passed to Collection.has() must be a string identifier, "+Object.prototype.toString(t)+" given");return t in this._container==!0},n.prototype.remove=function(t){if("string"!=typeof t)throw new TypeError("Argument #1 passed to Collection.remove() must be a string identifier");return delete this._container[t],this},n.prototype.set=function(t,e){if("string"!=typeof t)throw new TypeError("Argument #1 passed to Collection.set() must be a string identifier");return this._container[t]=e,this},n.prototype.setAll=function(t){if("object"!=typeof t)throw new TypeError("Argument #1 passed to Collection.setAll() must be an object");return this._container=t,this},n.prototype.addAll=function(t){if("object"!=typeof t)throw new TypeError("Argument #1 passed to Collection.addAll() must be an object");for(var e in t)this.set(e,t[e]);return this},n.prototype.addOnce=function(t,e,r){if(this.has(t)){if(r)return this;throw new Error("Identifier "+t+" passed to Collection.addOnce() is already defined")}return this.set(t,e)},n.prototype.addOnceAll=function(t,e){if("object"!=typeof t)throw new TypeError("Argument #1 passed to Collection.addOnceAll() must be an object");for(var r in t)this.addOnce(r,t[r],e);return this},n.prototype.merge=function(t){if("object"!=typeof t)throw new TypeError("Argument #1 passed to Collection.merge() must be an object");var e=Array.prototype.concat.apply([this._container],arguments);return this._container=o.mergeRecursive.apply(o,e),this},n.prototype.getAll=function(){return this._container},n.prototype.get=function(t,e,r){return"function"==typeof this._container[t]?this._container[t]():this.has(t)?this._container[t]:"function"==typeof e?this.raw(t,e,r)():this.raw(t,e,r)},n.prototype.raw=function(t,e,r){if(this.has(t))return this._container[t];if(r)throw new Error("Identifier "+t+" is not defined");return e},n.prototype.inject=function(t,e){if(Array.isArray(t)){for(var r in t)t[r]=this.raw(t[r]);return e.apply(null,t)}return"function"==typeof t?t(this._container):e(this.raw(t))},n.prototype.invoke=function(t,e){if(Array.isArray(t)){for(var r in t)t[r]=this.get(t[r]);return e.apply(null,t)}return"function"==typeof t?t(this._container):e(this.get(t))},n.prototype.apply=function(t){if(arguments.length>1){var e=Array.prototype.slice.call(arguments,1);return t.apply(this._container,e)}return t.call(this._container)},n.prototype.wrap=function(t){return function(){return t}},n.prototype.singleton=function(t,e){var r,n;if("string"!=typeof t)throw new TypeError("Argument #1 passed to Collection.singleton() must be a string identifier");if("function"!=typeof e)throw new TypeError("Argument #2 passed to Collection.singleton() must be a function");return this._container[t]=function(){return r||(r=!0,n=arguments.length?e.apply(null,arguments):e()),n},this},n.prototype.provider=function(t,e,r){var n,o,i=this;if("string"!=typeof t)throw new TypeError("Argument #1 passed to Collection.provider() must be a string identifier");return this._container[t]=function(){return n||(n=!0,o=i.inject(e,r)),o},this},n.prototype.factory=function(t,e,r){var n,o,i=this;if("string"!=typeof t)throw new TypeError("Argument #1 passed to Collection.factory() must be a string identifier");return this._container[t]=function(){return n||(n=!0,o=i.invoke(e,r)),o},this},t.exports=n},function(t,e,r){"use strict";function n(){this.$di=new n.prototype.$di,this.$di.addAll({$api:this,$di:this.$di,$container:this.$di._container,$invoke:this.$wrap(this.$invoke),$inject:this.$wrap(this.$inject),$provider:this.$wrap(this.$provider),$factory:this.$wrap(this.$factory),$singleton:this.$wrap(this.$singleton),$apply:this.$wrap(this.$apply),$wrap:this.$wrap(this.$wrap)})}var o=r(1),i={};n.prototype.Noder=n,n.prototype.$di=o,n.prototype.Collection=o,n.prototype.createCollection=function(t){return t?new this.Collection(t):new this.Collection},n.prototype.createNoder=function(){return new this.Noder},n.prototype.use=function(t){var e=function(t,e){if("function"!=typeof t.__noder)throw new TypeError("Argument #1 passed to Noder.use() is not a valid plugin for Noder.io.A plugin must implement a method named `__noder()` that is used for initialization. Example: `module.exports.__noder = function MyPlugin(noder) {\n // here, the bootstrap\n};`\n\nAPI doc: http://noder.io/api/noder.html#use");t=t.__noder,e.length>1?t.apply(null,Array.prototype.concat.apply([this],Array.prototype.slice.call(e,1))):t(this)}.bind(this);return"string"==typeof t?e(r(4)(t),arguments):e(t,arguments),this},n.prototype.$invoke=function(t,e){return this.$di.invoke(t,e)},n.prototype.$inject=function(t,e){return this.$di.inject(t,e)},n.prototype.$provider=function(t,e,r){return this.$di.provider(t,e,r),this},n.prototype.$factory=function(t,e,r){return this.$di.factory(t,e,r),this},n.prototype.$singleton=function(t,e){return this.$di.singleton(t,e),this},n.prototype.$apply=function(t){return this.$di.apply(t)},n.prototype.$wrap=function(t){return this.$di.wrap(t)},n.prototype.$require=function(t,e){return Object.defineProperty(this,t,{enumerable:!0,configurable:!1,get:function(){return this.$require.isLoaded(t)?i[t]:("undefined"==typeof e&&(e=t),i[t]="function"==typeof e?e.call(this._container):r(4)(e),i[t])},set:function(){throw new Error('"'+t+'" property is not writable because is a placeholder of a property of a lazy loading module.')}}),this},n.prototype.$require.isLoaded=function(t){return void 0!==i[t]},t.exports=new n},function(t){"use strict";t.exports.merge=function(t,e){if(t&&e)for(var r in e)t[r]=e[r];return t},t.exports.mergeRecursive=function(t){var e=arguments.length;if(2>e)throw new Error("There should be at least 2 arguments passed to utils.mergeRecursive()");for(var r=1;e>r;r++)for(var n in arguments[r])t[n]=t[n]&&"object"==typeof t[n]?this.mergeRecursive(t[n],arguments[r][n]):arguments[r][n];return t}},function(t,e,r){function n(t){return r(o(t))}function o(t){return i[t]||function(){throw new Error("Cannot find module '"+t+"'.")}()}var i={"./collection":1,"./collection.js":1,"./index":2,"./index.js":2,"./utils":3,"./utils.js":3};n.keys=function(){return Object.keys(i)},n.resolve=o,t.exports=n}]); \ No newline at end of file +/*! Noder.io | (c) 2014 Nicolas Tallefourtane | http://noder.io */ +!function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";if(!Array.isArray){var n=Object.prototype.toString();Array.isArray=function(t){return"[object Array]"===n.call(t)?!0:"function"==typeof t.slice&&"number"==typeof t.length?!0:!1}}window.noder=r(2)},function(t,e,r){"use strict";function n(t){if(this._container=t||{},t&&"object"!=typeof t)throw new TypeError("Argument #1 passed to Collection must be an object")}var o=r(3);n.prototype.keys=function(){return Object.keys(this._container)},n.prototype.has=function(t){if("string"!=typeof t)throw new TypeError("Argument #1 passed to Collection.has() must be a string identifier, "+Object.prototype.toString(t)+" given");return t in this._container==!0},n.prototype.remove=function(t){if("string"!=typeof t)throw new TypeError("Argument #1 passed to Collection.remove() must be a string identifier");return delete this._container[t],this},n.prototype.set=function(t,e){if("string"!=typeof t)throw new TypeError("Argument #1 passed to Collection.set() must be a string identifier");return this._container[t]=e,this},n.prototype.setAll=function(t){if("object"!=typeof t)throw new TypeError("Argument #1 passed to Collection.setAll() must be an object");return this._container=t,this},n.prototype.addAll=function(t){if("object"!=typeof t)throw new TypeError("Argument #1 passed to Collection.addAll() must be an object");for(var e in t)this.set(e,t[e]);return this},n.prototype.addOnce=function(t,e,r){if(this.has(t)){if(r)return this;throw new Error("Identifier "+t+" passed to Collection.addOnce() is already defined")}return this.set(t,e)},n.prototype.addOnceAll=function(t,e){if("object"!=typeof t)throw new TypeError("Argument #1 passed to Collection.addOnceAll() must be an object");for(var r in t)this.addOnce(r,t[r],e);return this},n.prototype.merge=function(t){if("object"!=typeof t)throw new TypeError("Argument #1 passed to Collection.merge() must be an object");var e=Array.prototype.concat.apply([this._container],arguments);return this._container=o.mergeRecursive.apply(o,e),this},n.prototype.getAll=function(){return this._container},n.prototype.get=function(t,e,r){return"function"==typeof this._container[t]?this._container[t]():this.has(t)?this._container[t]:"function"==typeof e?this.raw(t,e,r)():this.raw(t,e,r)},n.prototype.raw=function(t,e,r){if(this.has(t))return this._container[t];if(r)throw new Error("Identifier "+t+" is not defined");return e},n.prototype.inject=function(t,e){if(Array.isArray(t)){for(var r in t)t[r]=this.raw(t[r]);return e.apply(null,t)}return"function"==typeof t?t(this._container):e(this.raw(t))},n.prototype.invoke=function(t,e){if(Array.isArray(t)){for(var r in t)t[r]=this.get(t[r]);return e.apply(null,t)}return"function"==typeof t?t(this._container):e(this.get(t))},n.prototype.apply=function(t){if(arguments.length>1){var e=Array.prototype.slice.call(arguments,1);return t.apply(this._container,e)}return t.call(this._container)},n.prototype.wrap=function(t){return function(){return t}},n.prototype.singleton=function(t,e){var r,n;if("string"!=typeof t)throw new TypeError("Argument #1 passed to Collection.singleton() must be a string identifier");if("function"!=typeof e)throw new TypeError("Argument #2 passed to Collection.singleton() must be a function");return this._container[t]=function(){return r||(r=!0,n=arguments.length?e.apply(null,arguments):e()),n},this},n.prototype.provider=function(t,e,r){var n,o,i=this;if("string"!=typeof t)throw new TypeError("Argument #1 passed to Collection.provider() must be a string identifier");return this._container[t]=function(){return n||(n=!0,o=i.inject(e,r)),o},this},n.prototype.factory=function(t,e,r){var n,o,i=this;if("string"!=typeof t)throw new TypeError("Argument #1 passed to Collection.factory() must be a string identifier");return this._container[t]=function(){return n||(n=!0,o=i.invoke(e,r)),o},this},t.exports=n},function(t,e,r){"use strict";function n(){this.$di=new n.prototype.$di,this.$di.addAll({$api:this,$di:this.$di,$container:this.$di._container,$invoke:this.$wrap(this.$invoke),$inject:this.$wrap(this.$inject),$provider:this.$wrap(this.$provider),$factory:this.$wrap(this.$factory),$singleton:this.$wrap(this.$singleton),$apply:this.$wrap(this.$apply),$wrap:this.$wrap(this.$wrap)})}var o=r(1),i={};n.prototype.Noder=n,n.prototype.$di=o,n.prototype.Collection=o,n.prototype.createCollection=function(t){return t?new this.Collection(t):new this.Collection},n.prototype.createNoder=function(){return new this.Noder},n.prototype.use=function(t){var e=function(t,e){if("function"!=typeof t.__noder)throw new TypeError("Argument #1 passed to Noder.use() is not a valid plugin for Noder.io.A plugin must implement a method named `__noder()` that is used for initialization. Example: `module.exports.__noder = function MyPlugin(noder) {\n // here, the bootstrap\n};`\n\nAPI doc: http://noder.io/api/noder.html#use");t=t.__noder,e.length>1?t.apply(null,Array.prototype.concat.apply([this],Array.prototype.slice.call(e,1))):t(this)}.bind(this);return"string"==typeof t?e(r(4)(t),arguments):e(t,arguments),this},n.prototype.$invoke=function(t,e){return this.$di.invoke(t,e)},n.prototype.$inject=function(t,e){return this.$di.inject(t,e)},n.prototype.$provider=function(t,e,r){return this.$di.provider(t,e,r),this},n.prototype.$factory=function(t,e,r){return this.$di.factory(t,e,r),this},n.prototype.$singleton=function(t,e){return this.$di.singleton(t,e),this},n.prototype.$apply=function(t){return this.$di.apply(t)},n.prototype.$wrap=function(t){return this.$di.wrap(t)},n.prototype.$require=function(t,e){return Object.defineProperty(this,t,{enumerable:!0,configurable:!1,get:function(){return this.$require.isLoaded(t)?i[t]:("undefined"==typeof e&&(e=t),i[t]="function"==typeof e?e.call(this._container):r(4)(e),i[t])},set:function(){throw new Error('"'+t+'" property is not writable because is a placeholder of a property of a lazy loading module.')}}),this},n.prototype.$require.isLoaded=function(t){return void 0!==i[t]},t.exports=new n},function(t){"use strict";t.exports.merge=function(t,e){if(t&&e)for(var r in e)t[r]=e[r];return t},t.exports.mergeRecursive=function(t){var e=arguments.length;if(2>e)throw new Error("There should be at least 2 arguments passed to utils.mergeRecursive()");for(var r=1;e>r;r++)for(var n in arguments[r])t[n]=t[n]&&"object"==typeof t[n]?this.mergeRecursive(t[n],arguments[r][n]):arguments[r][n];return t}},function(t,e,r){function n(t){return r(o(t))}function o(t){return i[t]||function(){throw new Error("Cannot find module '"+t+"'.")}()}var i={"./collection":1,"./collection.js":1,"./index":2,"./index.js":2,"./utils":3,"./utils.js":3};n.keys=function(){return Object.keys(i)},n.resolve=o,t.exports=n}]); \ No newline at end of file diff --git a/package.json b/package.json index bcb60fb..071c128 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "noder.io", - "version": "1.0.0", + "version": "1.0.1", "description": "Noder.io provides a lightweight IOC container to build the core of a scalable API. No dependencies, works on Node.js and in the browser (only 4kb).", "main": "src/index.js", "keywords": [