Bump to v3.6.0.

This commit is contained in:
jdalton
2015-03-24 19:28:36 -07:00
parent ee1f12c851
commit 801ffd8adf
193 changed files with 1213 additions and 976 deletions

View File

@@ -5,7 +5,7 @@ import createAssigner from '../internal/createAssigner';
* Assigns own enumerable properties of source object(s) to the destination
* object. Subsequent sources overwrite property assignments of previous sources.
* If `customizer` is provided it is invoked to produce the assigned values.
* The `customizer` is bound to `thisArg` and invoked with five arguments;
* The `customizer` is bound to `thisArg` and invoked with five arguments:
* (objectValue, sourceValue, key, object, source).
*
* @static

View File

@@ -1,6 +1,6 @@
import arrayCopy from '../internal/arrayCopy';
import assign from './assign';
import assignDefaults from '../internal/assignDefaults';
import restParam from '../function/restParam';
/**
* Assigns own enumerable properties of source object(s) to the destination
@@ -18,13 +18,13 @@ import assignDefaults from '../internal/assignDefaults';
* _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
* // => { 'user': 'barney', 'age': 36 }
*/
function defaults(object) {
var defaults = restParam(function(args) {
var object = args[0];
if (object == null) {
return object;
}
var args = arrayCopy(arguments);
args.push(assignDefaults);
return assign.apply(undefined, args);
}
});
export default defaults;

View File

@@ -1,10 +1,9 @@
import baseCallback from '../internal/baseCallback';
import baseFind from '../internal/baseFind';
import baseForOwn from '../internal/baseForOwn';
import createFindKey from '../internal/createFindKey';
/**
* This method is like `_.findIndex` except that it returns the key of the
* first element `predicate` returns truthy for, instead of the element itself.
* This method is like `_.find` except that it returns the key of the first
* element `predicate` returns truthy for instead of the element itself.
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
@@ -50,9 +49,6 @@ import baseForOwn from '../internal/baseForOwn';
* _.findKey(users, 'active');
* // => 'barney'
*/
function findKey(object, predicate, thisArg) {
predicate = baseCallback(predicate, thisArg, 3);
return baseFind(object, predicate, baseForOwn, true);
}
var findKey = createFindKey(baseForOwn);
export default findKey;

View File

@@ -1,6 +1,5 @@
import baseCallback from '../internal/baseCallback';
import baseFind from '../internal/baseFind';
import baseForOwnRight from '../internal/baseForOwnRight';
import createFindKey from '../internal/createFindKey';
/**
* This method is like `_.findKey` except that it iterates over elements of
@@ -50,9 +49,6 @@ import baseForOwnRight from '../internal/baseForOwnRight';
* _.findLastKey(users, 'active');
* // => 'pebbles'
*/
function findLastKey(object, predicate, thisArg) {
predicate = baseCallback(predicate, thisArg, 3);
return baseFind(object, predicate, baseForOwnRight, true);
}
var findLastKey = createFindKey(baseForOwnRight);
export default findLastKey;

View File

@@ -1,11 +1,10 @@
import baseFor from '../internal/baseFor';
import bindCallback from '../internal/bindCallback';
import keysIn from './keysIn';
import createForIn from '../internal/createForIn';
/**
* Iterates over own and inherited enumerable properties of an object invoking
* `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked
* with three arguments; (value, key, object). Iterator functions may exit
* with three arguments: (value, key, object). Iterator functions may exit
* iteration early by explicitly returning `false`.
*
* @static
@@ -29,11 +28,6 @@ import keysIn from './keysIn';
* });
* // => logs 'a', 'b', and 'c' (iteration order is not guaranteed)
*/
function forIn(object, iteratee, thisArg) {
if (typeof iteratee != 'function' || typeof thisArg != 'undefined') {
iteratee = bindCallback(iteratee, thisArg, 3);
}
return baseFor(object, iteratee, keysIn);
}
var forIn = createForIn(baseFor);
export default forIn;

View File

@@ -1,6 +1,5 @@
import baseForRight from '../internal/baseForRight';
import bindCallback from '../internal/bindCallback';
import keysIn from './keysIn';
import createForIn from '../internal/createForIn';
/**
* This method is like `_.forIn` except that it iterates over properties of
@@ -27,9 +26,6 @@ import keysIn from './keysIn';
* });
* // => logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c'
*/
function forInRight(object, iteratee, thisArg) {
iteratee = bindCallback(iteratee, thisArg, 3);
return baseForRight(object, iteratee, keysIn);
}
var forInRight = createForIn(baseForRight);
export default forInRight;

View File

@@ -1,10 +1,10 @@
import baseForOwn from '../internal/baseForOwn';
import bindCallback from '../internal/bindCallback';
import createForOwn from '../internal/createForOwn';
/**
* Iterates over own enumerable properties of an object invoking `iteratee`
* for each property. The `iteratee` is bound to `thisArg` and invoked with
* three arguments; (value, key, object). Iterator functions may exit iteration
* three arguments: (value, key, object). Iterator functions may exit iteration
* early by explicitly returning `false`.
*
* @static
@@ -28,11 +28,6 @@ import bindCallback from '../internal/bindCallback';
* });
* // => logs 'a' and 'b' (iteration order is not guaranteed)
*/
function forOwn(object, iteratee, thisArg) {
if (typeof iteratee != 'function' || typeof thisArg != 'undefined') {
iteratee = bindCallback(iteratee, thisArg, 3);
}
return baseForOwn(object, iteratee);
}
var forOwn = createForOwn(baseForOwn);
export default forOwn;

View File

@@ -1,6 +1,5 @@
import baseForRight from '../internal/baseForRight';
import bindCallback from '../internal/bindCallback';
import keys from './keys';
import baseForOwnRight from '../internal/baseForOwnRight';
import createForOwn from '../internal/createForOwn';
/**
* This method is like `_.forOwn` except that it iterates over properties of
@@ -27,9 +26,6 @@ import keys from './keys';
* });
* // => logs 'b' and 'a' assuming `_.forOwn` logs 'a' and 'b'
*/
function forOwnRight(object, iteratee, thisArg) {
iteratee = bindCallback(iteratee, thisArg, 3);
return baseForRight(object, iteratee, keys);
}
var forOwnRight = createForOwn(baseForOwnRight);
export default forOwnRight;

View File

@@ -4,7 +4,7 @@ import baseForOwn from '../internal/baseForOwn';
/**
* Creates an object with the same keys as `object` and values generated by
* running each own enumerable property of `object` through `iteratee`. The
* iteratee function is bound to `thisArg` and invoked with three arguments;
* iteratee function is bound to `thisArg` and invoked with three arguments:
* (value, key, object).
*
* If a property name is provided for `iteratee` the created `_.property`

View File

@@ -8,7 +8,7 @@ import createAssigner from '../internal/createAssigner';
* provided it is invoked to produce the merged values of the destination and
* source properties. If `customizer` returns `undefined` merging is handled
* by the method instead. The `customizer` is bound to `thisArg` and invoked
* with five arguments; (objectValue, sourceValue, key, object, source).
* with five arguments: (objectValue, sourceValue, key, object, source).
*
* @static
* @memberOf _

View File

@@ -5,6 +5,7 @@ import bindCallback from '../internal/bindCallback';
import keysIn from './keysIn';
import pickByArray from '../internal/pickByArray';
import pickByCallback from '../internal/pickByCallback';
import restParam from '../function/restParam';
/**
* The opposite of `_.pick`; this method creates an object composed of the
@@ -12,7 +13,7 @@ import pickByCallback from '../internal/pickByCallback';
* Property names may be specified as individual arguments or as arrays of
* property names. If `predicate` is provided it is invoked for each property
* of `object` omitting the properties `predicate` returns truthy for. The
* predicate is bound to `thisArg` and invoked with three arguments;
* predicate is bound to `thisArg` and invoked with three arguments:
* (value, key, object).
*
* @static
@@ -34,18 +35,18 @@ import pickByCallback from '../internal/pickByCallback';
* _.omit(object, _.isNumber);
* // => { 'user': 'fred' }
*/
function omit(object, predicate, thisArg) {
var omit = restParam(function(object, props) {
if (object == null) {
return {};
}
if (typeof predicate != 'function') {
var props = arrayMap(baseFlatten(arguments, false, false, 1), String);
if (typeof props[0] != 'function') {
var props = arrayMap(baseFlatten(props), String);
return pickByArray(object, baseDifference(keysIn(object), props));
}
predicate = bindCallback(predicate, thisArg, 3);
var predicate = bindCallback(props[0], props[1], 3);
return pickByCallback(object, function(value, key, object) {
return !predicate(value, key, object);
});
}
});
export default omit;

View File

@@ -2,13 +2,14 @@ import baseFlatten from '../internal/baseFlatten';
import bindCallback from '../internal/bindCallback';
import pickByArray from '../internal/pickByArray';
import pickByCallback from '../internal/pickByCallback';
import restParam from '../function/restParam';
/**
* Creates an object composed of the picked `object` properties. Property
* names may be specified as individual arguments or as arrays of property
* names. If `predicate` is provided it is invoked for each property of `object`
* picking the properties `predicate` returns truthy for. The predicate is
* bound to `thisArg` and invoked with three arguments; (value, key, object).
* bound to `thisArg` and invoked with three arguments: (value, key, object).
*
* @static
* @memberOf _
@@ -29,13 +30,13 @@ import pickByCallback from '../internal/pickByCallback';
* _.pick(object, _.isString);
* // => { 'user': 'fred' }
*/
function pick(object, predicate, thisArg) {
var pick = restParam(function(object, props) {
if (object == null) {
return {};
}
return typeof predicate == 'function'
? pickByCallback(object, bindCallback(predicate, thisArg, 3))
: pickByArray(object, baseFlatten(arguments, false, false, 1));
}
return typeof props[0] == 'function'
? pickByCallback(object, bindCallback(props[0], props[1], 3))
: pickByArray(object, baseFlatten(props));
});
export default pick;

View File

@@ -12,7 +12,7 @@ import isTypedArray from '../lang/isTypedArray';
* `accumulator` object which is the result of running each of its own enumerable
* properties through `iteratee`, with each invocation potentially mutating
* the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked
* with four arguments; (accumulator, value, key, object). Iterator functions
* with four arguments: (accumulator, value, key, object). Iterator functions
* may exit iteration early by explicitly returning `false`.
*
* @static