Tweak lodash, shimIsPlainObject, shimKeys, and reduce function docs. [ci skip]

Former-commit-id: f24dd4de2a5a6c8103f26d000f1f16b5be3d8165
This commit is contained in:
John-David Dalton
2013-04-10 20:38:26 -07:00
parent 54eeef173a
commit d1498bb9fb
5 changed files with 241 additions and 139 deletions

View File

@@ -144,7 +144,7 @@
/*--------------------------------------------------------------------------*/
/**
* Creates a `lodash` object, that wraps the given `value`, to enable method
* Creates a `lodash` object, which wraps the given `value`, to enable method
* chaining.
*
* In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
@@ -182,6 +182,26 @@
* @category Chaining
* @param {Mixed} value The value to wrap in a `lodash` instance.
* @returns {Object} Returns a `lodash` instance.
* @example
*
* var wrapped = _([1, 2, 3]);
*
* // returns an unwrapped value
* wrapped.reduce(function(sum, num) {
* return sum + num;
* });
* // => 6
*
* // returns a wrapped value
* var squares = wrapped.map(function(num) {
* return num * num;
* });
*
* _.isArray(squares);
* // => false
*
* _.isArray(squares.value());
* // => true
*/
function lodash(value) {
return (value instanceof lodash)
@@ -486,7 +506,7 @@
};
/**
* A fallback implementation of `Object.keys` that produces an array of the
* A fallback implementation of `Object.keys` which produces an array of the
* given object's own enumerable property names.
*
* @private
@@ -2030,7 +2050,7 @@
}
/**
* Reduces a `collection` to a value that is the accumulated result of running
* Reduces a `collection` to a value which is the accumulated result of running
* each element in the `collection` through the `callback`, where each successive
* `callback` execution consumes the return value of the previous execution.
* If `accumulator` is not passed, the first element of the `collection` will be