mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 11:27:50 +00:00
Tweak lodash, shimIsPlainObject, shimKeys, and reduce function docs. [ci skip]
Former-commit-id: f24dd4de2a5a6c8103f26d000f1f16b5be3d8165
This commit is contained in:
28
dist/lodash.compat.js
vendored
28
dist/lodash.compat.js
vendored
@@ -209,7 +209,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.
|
* chaining.
|
||||||
*
|
*
|
||||||
* In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
|
* In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
|
||||||
@@ -247,6 +247,26 @@
|
|||||||
* @category Chaining
|
* @category Chaining
|
||||||
* @param {Mixed} value The value to wrap in a `lodash` instance.
|
* @param {Mixed} value The value to wrap in a `lodash` instance.
|
||||||
* @returns {Object} Returns 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) {
|
function lodash(value) {
|
||||||
// don't wrap if already wrapped, even if wrapped by a different `lodash` constructor
|
// don't wrap if already wrapped, even if wrapped by a different `lodash` constructor
|
||||||
@@ -807,7 +827,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A fallback implementation of `isPlainObject` that checks if a given `value`
|
* A fallback implementation of `isPlainObject` which checks if a given `value`
|
||||||
* is an object created by the `Object` constructor, assuming objects created
|
* is an object created by the `Object` constructor, assuming objects created
|
||||||
* by the `Object` constructor have no inherited enumerable properties and that
|
* by the `Object` constructor have no inherited enumerable properties and that
|
||||||
* there are no `Object.prototype` extensions.
|
* there are no `Object.prototype` extensions.
|
||||||
@@ -937,7 +957,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.
|
* given object's own enumerable property names.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
@@ -2875,7 +2895,7 @@
|
|||||||
var pluck = map;
|
var pluck = map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* each element in the `collection` through the `callback`, where each successive
|
||||||
* `callback` execution consumes the return value of the previous execution.
|
* `callback` execution consumes the return value of the previous execution.
|
||||||
* If `accumulator` is not passed, the first element of the `collection` will be
|
* If `accumulator` is not passed, the first element of the `collection` will be
|
||||||
|
|||||||
28
dist/lodash.js
vendored
28
dist/lodash.js
vendored
@@ -203,7 +203,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.
|
* chaining.
|
||||||
*
|
*
|
||||||
* In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
|
* In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
|
||||||
@@ -241,6 +241,26 @@
|
|||||||
* @category Chaining
|
* @category Chaining
|
||||||
* @param {Mixed} value The value to wrap in a `lodash` instance.
|
* @param {Mixed} value The value to wrap in a `lodash` instance.
|
||||||
* @returns {Object} Returns 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) {
|
function lodash(value) {
|
||||||
// don't wrap if already wrapped, even if wrapped by a different `lodash` constructor
|
// don't wrap if already wrapped, even if wrapped by a different `lodash` constructor
|
||||||
@@ -641,7 +661,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A fallback implementation of `isPlainObject` that checks if a given `value`
|
* A fallback implementation of `isPlainObject` which checks if a given `value`
|
||||||
* is an object created by the `Object` constructor, assuming objects created
|
* is an object created by the `Object` constructor, assuming objects created
|
||||||
* by the `Object` constructor have no inherited enumerable properties and that
|
* by the `Object` constructor have no inherited enumerable properties and that
|
||||||
* there are no `Object.prototype` extensions.
|
* there are no `Object.prototype` extensions.
|
||||||
@@ -755,7 +775,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.
|
* given object's own enumerable property names.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
@@ -2676,7 +2696,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
|
* each element in the `collection` through the `callback`, where each successive
|
||||||
* `callback` execution consumes the return value of the previous execution.
|
* `callback` execution consumes the return value of the previous execution.
|
||||||
* If `accumulator` is not passed, the first element of the `collection` will be
|
* If `accumulator` is not passed, the first element of the `collection` will be
|
||||||
|
|||||||
26
dist/lodash.underscore.js
vendored
26
dist/lodash.underscore.js
vendored
@@ -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.
|
* chaining.
|
||||||
*
|
*
|
||||||
* In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
|
* In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
|
||||||
@@ -182,6 +182,26 @@
|
|||||||
* @category Chaining
|
* @category Chaining
|
||||||
* @param {Mixed} value The value to wrap in a `lodash` instance.
|
* @param {Mixed} value The value to wrap in a `lodash` instance.
|
||||||
* @returns {Object} Returns 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) {
|
function lodash(value) {
|
||||||
return (value instanceof lodash)
|
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.
|
* given object's own enumerable property names.
|
||||||
*
|
*
|
||||||
* @private
|
* @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
|
* each element in the `collection` through the `callback`, where each successive
|
||||||
* `callback` execution consumes the return value of the previous execution.
|
* `callback` execution consumes the return value of the previous execution.
|
||||||
* If `accumulator` is not passed, the first element of the `collection` will be
|
* If `accumulator` is not passed, the first element of the `collection` will be
|
||||||
|
|||||||
270
doc/README.md
270
doc/README.md
File diff suppressed because it is too large
Load Diff
28
lodash.js
28
lodash.js
@@ -208,7 +208,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.
|
* chaining.
|
||||||
*
|
*
|
||||||
* In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
|
* In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
|
||||||
@@ -246,6 +246,26 @@
|
|||||||
* @category Chaining
|
* @category Chaining
|
||||||
* @param {Mixed} value The value to wrap in a `lodash` instance.
|
* @param {Mixed} value The value to wrap in a `lodash` instance.
|
||||||
* @returns {Object} Returns 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) {
|
function lodash(value) {
|
||||||
// don't wrap if already wrapped, even if wrapped by a different `lodash` constructor
|
// don't wrap if already wrapped, even if wrapped by a different `lodash` constructor
|
||||||
@@ -816,7 +836,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A fallback implementation of `isPlainObject` that checks if a given `value`
|
* A fallback implementation of `isPlainObject` which checks if a given `value`
|
||||||
* is an object created by the `Object` constructor, assuming objects created
|
* is an object created by the `Object` constructor, assuming objects created
|
||||||
* by the `Object` constructor have no inherited enumerable properties and that
|
* by the `Object` constructor have no inherited enumerable properties and that
|
||||||
* there are no `Object.prototype` extensions.
|
* there are no `Object.prototype` extensions.
|
||||||
@@ -946,7 +966,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.
|
* given object's own enumerable property names.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
@@ -2885,7 +2905,7 @@
|
|||||||
var pluck = map;
|
var pluck = map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* each element in the `collection` through the `callback`, where each successive
|
||||||
* `callback` execution consumes the return value of the previous execution.
|
* `callback` execution consumes the return value of the previous execution.
|
||||||
* If `accumulator` is not passed, the first element of the `collection` will be
|
* If `accumulator` is not passed, the first element of the `collection` will be
|
||||||
|
|||||||
Reference in New Issue
Block a user