Skip to content

Commit

Permalink
[doc] Update API doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolab committed Oct 20, 2014
1 parent ce39db3 commit f551046
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
10 changes: 6 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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()`.
Expand Down
13 changes: 8 additions & 5 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand All @@ -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
Expand All @@ -59,5 +61,6 @@ module.exports.mergeRecursive = function mergeRecursive(obj) {
}
}
}

return obj;
};

0 comments on commit f551046

Please sign in to comment.