mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Bump to v3.3.0.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
define(['../internal/baseSlice', '../lang/isError'], function(baseSlice, isError) {
|
||||
define(['../lang/isError'], function(isError) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -23,9 +23,16 @@ define(['../internal/baseSlice', '../lang/isError'], function(baseSlice, isError
|
||||
* elements = [];
|
||||
* }
|
||||
*/
|
||||
function attempt(func) {
|
||||
function attempt() {
|
||||
var length = arguments.length,
|
||||
func = arguments[0];
|
||||
|
||||
try {
|
||||
return func.apply(undefined, baseSlice(arguments, 1));
|
||||
var args = Array(length ? length - 1 : 0);
|
||||
while (--length > 0) {
|
||||
args[length - 1] = arguments[length];
|
||||
}
|
||||
return func.apply(undefined, args);
|
||||
} catch(e) {
|
||||
return isError(e) ? e : new Error(e);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,9 @@ define(['../internal/baseCallback', '../internal/isIterateeCall', '../internal/i
|
||||
* return callback(func, thisArg);
|
||||
* }
|
||||
* return function(object) {
|
||||
* return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3];
|
||||
* return match[2] == 'gt'
|
||||
* ? object[match[1]] > match[3]
|
||||
* : object[match[1]] < match[3];
|
||||
* };
|
||||
* });
|
||||
*
|
||||
|
||||
@@ -12,6 +12,7 @@ define([], function() {
|
||||
*
|
||||
* var object = { 'user': 'fred' };
|
||||
* var getter = _.constant(object);
|
||||
*
|
||||
* getter() === object;
|
||||
* // => true
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,7 @@ define([], function() {
|
||||
* @example
|
||||
*
|
||||
* var object = { 'user': 'fred' };
|
||||
*
|
||||
* _.identity(object) === object;
|
||||
* // => true
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* A no-operation function.
|
||||
* A no-operation function which returns `undefined` regardless of the
|
||||
* arguments it receives.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -9,6 +10,7 @@ define([], function() {
|
||||
* @example
|
||||
*
|
||||
* var object = { 'user': 'fred' };
|
||||
*
|
||||
* _.noop(object) === undefined;
|
||||
* // => true
|
||||
*/
|
||||
|
||||
@@ -14,11 +14,11 @@ define([], function() {
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'user': 'fred', 'age': 40, 'active': true };
|
||||
* _.map(['active', 'user'], _.propertyOf(object));
|
||||
* // => [true, 'fred']
|
||||
*
|
||||
* var object = { 'a': 3, 'b': 1, 'c': 2 };
|
||||
*
|
||||
* _.map(['a', 'c'], _.propertyOf(object));
|
||||
* // => [3, 2]
|
||||
*
|
||||
* _.sortBy(['a', 'b', 'c'], _.propertyOf(object));
|
||||
* // => ['b', 'c', 'a']
|
||||
*/
|
||||
|
||||
@@ -8,8 +8,9 @@ define(['../internal/isIterateeCall'], function(isIterateeCall) {
|
||||
|
||||
/**
|
||||
* Creates an array of numbers (positive and/or negative) progressing from
|
||||
* `start` up to, but not including, `end`. If `start` is less than `end` a
|
||||
* zero-length range is created unless a negative `step` is specified.
|
||||
* `start` up to, but not including, `end`. If `end` is not specified it
|
||||
* defaults to `start` with `start` becoming `0`. If `start` is less than
|
||||
* `end` a zero-length range is created unless a negative `step` is specified.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -24,10 +24,14 @@ define(['../internal/bindCallback', '../internal/root'], function(bindCallback,
|
||||
* var diceRolls = _.times(3, _.partial(_.random, 1, 6, false));
|
||||
* // => [3, 6, 4]
|
||||
*
|
||||
* _.times(3, function(n) { mage.castSpell(n); });
|
||||
* _.times(3, function(n) {
|
||||
* mage.castSpell(n);
|
||||
* });
|
||||
* // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2` respectively
|
||||
*
|
||||
* _.times(3, function(n) { this.cast(n); }, mage);
|
||||
* _.times(3, function(n) {
|
||||
* this.cast(n);
|
||||
* }, mage);
|
||||
* // => also invokes `mage.castSpell(n)` three times
|
||||
*/
|
||||
function times(n, iteratee, thisArg) {
|
||||
|
||||
Reference in New Issue
Block a user