Bump to v3.9.0.

This commit is contained in:
jdalton
2015-05-17 22:50:59 -07:00
parent d7b2bedafc
commit 30daf83737
89 changed files with 527 additions and 567 deletions

View File

@@ -2,7 +2,7 @@ import baseGet from '../internal/baseGet';
import toPath from '../internal/toPath';
/**
* Gets the property value of `path` on `object`. If the resolved value is
* Gets the property value at `path` of `object`. If the resolved value is
* `undefined` the `defaultValue` is used in its place.
*
* @static

View File

@@ -1,6 +1,10 @@
import baseGet from '../internal/baseGet';
import baseSlice from '../internal/baseSlice';
import isArguments from '../lang/isArguments';
import isArray from '../lang/isArray';
import isIndex from '../internal/isIndex';
import isKey from '../internal/isKey';
import isLength from '../internal/isLength';
import last from '../array/last';
import toPath from '../internal/toPath';
@@ -40,10 +44,14 @@ function has(object, path) {
if (!result && !isKey(path)) {
path = toPath(path);
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
if (object == null) {
return false;
}
path = last(path);
result = object != null && hasOwnProperty.call(object, path);
result = hasOwnProperty.call(object, path);
}
return result;
return result || (isLength(object.length) && isIndex(path, object.length) &&
(isArray(object) || isArguments(object)));
}
export default has;

View File

@@ -1,10 +1,10 @@
import getNative from '../internal/getNative';
import isArrayLike from '../internal/isArrayLike';
import isNative from '../lang/isNative';
import isObject from '../lang/isObject';
import shimKeys from '../internal/shimKeys';
/* Native method references for those with the same name as other `lodash` methods. */
var nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys;
var nativeKeys = getNative(Object, 'keys');
/**
* Creates an array of the own enumerable property names of `object`.
@@ -34,7 +34,7 @@ var nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys;
* // => ['0', '1']
*/
var keys = !nativeKeys ? shimKeys : function(object) {
var Ctor = object != null && object.constructor;
var Ctor = object == null ? null : object.constructor;
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
(typeof object != 'function' && isArrayLike(object))) {
return shimKeys(object);

View File

@@ -3,7 +3,6 @@ import isArray from '../lang/isArray';
import isIndex from '../internal/isIndex';
import isLength from '../internal/isLength';
import isObject from '../lang/isObject';
import support from '../support';
/** Used for native method references. */
var objectProto = Object.prototype;
@@ -42,7 +41,7 @@ function keysIn(object) {
}
var length = object.length;
length = (length && isLength(length) &&
(isArray(object) || (support.nonEnumArgs && isArguments(object))) && length) || 0;
(isArray(object) || isArguments(object)) && length) || 0;
var Ctor = object.constructor,
index = -1,

View File

@@ -1,4 +1,5 @@
import keys from './keys';
import toObject from '../internal/toObject';
/**
* Creates a two dimensional array of the key-value pairs for `object`,
@@ -15,6 +16,8 @@ import keys from './keys';
* // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)
*/
function pairs(object) {
object = toObject(object);
var index = -1,
props = keys(object),
length = props.length,

View File

@@ -46,7 +46,7 @@ function transform(object, iteratee, accumulator, thisArg) {
if (isArr) {
accumulator = isArray(object) ? new Ctor : [];
} else {
accumulator = baseCreate(isFunction(Ctor) && Ctor.prototype);
accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : null);
}
} else {
accumulator = {};