From f551046a25a18fbc7f3b53aab99d097f007dd495 Mon Sep 17 00:00:00 2001 From: "Nicolab.net" Date: Mon, 20 Oct 2014 16:35:22 +0200 Subject: [PATCH] [doc] Update API doc --- src/index.js | 10 ++++++---- src/utils.js | 13 ++++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/index.js b/src/index.js index 83b3d38..55e1525 100644 --- a/src/index.js +++ b/src/index.js @@ -33,13 +33,13 @@ var loaded = {}; * // true * console.log(noder instanceof noder.Noder); * - * noder.set('hello', '-> Hello from a.js file.'); + * noder.$di.set('hello', '-> Hello from a.js file.'); * * // file: b.js * var noder = require('noder.io'); * * // -> Hello from a.js file. - * console.log(noder.get('hello')); + * console.log(noder.$di.get('hello')); * * @constructor * @@ -394,7 +394,7 @@ Noder.prototype.$singleton = function $singleton(key, fn) { * (`noder.$di._container`). * * @example - * noder.set('name', 'Nico'); + * noder.$di.set('name', 'Nico'); * * // returns 'Nico' * noder.$apply(function() { @@ -455,7 +455,9 @@ Noder.prototype.$wrap = function $wrap(value) { * @param {string|function} [required] The module name or the JS file path * required to set the property value. * Or a custom loader handler - * via a given function. + * via a given function, the scope (`this`) + * bind to `noder.$di._container` + * like `noder.$apply()`. * * Note: * * The `required` argument is passed to the function `require()`. diff --git a/src/utils.js b/src/utils.js index a079af3..c3ec5a4 100644 --- a/src/utils.js +++ b/src/utils.js @@ -15,11 +15,12 @@ /** * Merge object `b` in object `a`. * - * var a = { foo: 'bar' } - * , b = { bar: 'baz' }; + * @example + * var a = { foo: 'bar' }; + * var b = { bar: 'baz' }; * - * utils.merge(a, b); - * // => { foo: 'bar', bar: 'baz' } + * utils.merge(a, b); + * // => { foo: 'bar', bar: 'baz' } * * @param {Object} a Object that receives the value of `b`. * @param {Object} b Object to merge in `a`. @@ -37,7 +38,8 @@ module.exports.merge = function merge(a, b) { }; /** - * Merge recursive + * Merge recursive. + * * @param {object|array} obj Object that receives the value of `from` * @param {...object|array} from One or more objects to merge in `obj`. * @return {Object} `obj` merged @@ -59,5 +61,6 @@ module.exports.mergeRecursive = function mergeRecursive(obj) { } } } + return obj; }; \ No newline at end of file