Bump to v3.3.0.

This commit is contained in:
jdalton
2015-02-20 00:57:26 -08:00
parent 05cb7419a6
commit 5dc85cc9a8
91 changed files with 830 additions and 408 deletions

View File

@@ -1,5 +1,4 @@
var baseSlice = require('../internal/baseSlice'),
isError = require('../lang/isError');
var isError = require('../lang/isError');
/**
* Attempts to invoke `func`, returning either the result or the caught error
@@ -21,9 +20,16 @@ var baseSlice = require('../internal/baseSlice'),
* 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);
}

View File

@@ -32,7 +32,9 @@ var baseCallback = require('../internal/baseCallback'),
* 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];
* };
* });
*

View File

@@ -10,6 +10,7 @@
*
* var object = { 'user': 'fred' };
* var getter = _.constant(object);
*
* getter() === object;
* // => true
*/

View File

@@ -9,6 +9,7 @@
* @example
*
* var object = { 'user': 'fred' };
*
* _.identity(object) === object;
* // => true
*/

View File

@@ -1,5 +1,6 @@
/**
* A no-operation function.
* A no-operation function which returns `undefined` regardless of the
* arguments it receives.
*
* @static
* @memberOf _
@@ -7,6 +8,7 @@
* @example
*
* var object = { 'user': 'fred' };
*
* _.noop(object) === undefined;
* // => true
*/

View File

@@ -9,11 +9,11 @@
* @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']
*/

View File

@@ -8,8 +8,9 @@ var nativeMax = Math.max;
/**
* 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 _

View File

@@ -24,10 +24,14 @@ var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1;
* 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) {