Make support references align with templateSetting references.

This commit is contained in:
John-David Dalton
2014-09-26 09:43:33 -07:00
parent 2ffdc4f2ef
commit 71de0f2d08

View File

@@ -1431,6 +1431,7 @@
} }
var data = getData(func); var data = getData(func);
if (typeof data == 'undefined') { if (typeof data == 'undefined') {
var support = lodash.support;
if (support.funcNames) { if (support.funcNames) {
data = !func.name; data = !func.name;
} }
@@ -1687,8 +1688,8 @@
} }
/** /**
* The base implementation of `_.filter` without support for callback shorthands * The base implementation of `_.filter` without support for callback
* or `this` binding. * shorthands or `this` binding.
* *
* @private * @private
* @param {Array|Object|string} collection The collection to iterate over. * @param {Array|Object|string} collection The collection to iterate over.
@@ -1953,7 +1954,7 @@
return false; return false;
} }
if (valIsErr || valIsObj) { if (valIsErr || valIsObj) {
if (!support.argsClass) { if (!lodash.support.argsClass) {
valIsArg = isArguments(value); valIsArg = isArguments(value);
othIsArg = isArguments(other); othIsArg = isArguments(other);
} }
@@ -2961,7 +2962,7 @@
return object; return object;
} }
var Ctor = object.constructor, var Ctor = object.constructor,
isArgs = className == argsClass || (!support.argsClass && isArguments(object)), isArgs = className == argsClass || (!lodash.support.argsClass && isArguments(object)),
isObj = className == objectClass; isObj = className == objectClass;
if (isObj && !(typeof Ctor == 'function' && Ctor instanceof Ctor)) { if (isObj && !(typeof Ctor == 'function' && Ctor instanceof Ctor)) {
@@ -3115,7 +3116,7 @@
*/ */
function shimIsPlainObject(value) { function shimIsPlainObject(value) {
var Ctor, var Ctor,
result; support = lodash.support;
// exit early for non `Object` objects // exit early for non `Object` objects
if (!(value && typeof value == 'object' && if (!(value && typeof value == 'object' &&
@@ -3128,6 +3129,7 @@
// IE < 9 iterates inherited properties before own properties. If the first // IE < 9 iterates inherited properties before own properties. If the first
// iterated property is an object's own property then there are no inherited // iterated property is an object's own property then there are no inherited
// enumerable properties. // enumerable properties.
var result;
if (support.ownLast) { if (support.ownLast) {
baseForIn(value, function(value, key, object) { baseForIn(value, function(value, key, object) {
result = hasOwnProperty.call(object, key); result = hasOwnProperty.call(object, key);
@@ -3153,18 +3155,20 @@
* @returns {Array} Returns the array of property names. * @returns {Array} Returns the array of property names.
*/ */
function shimKeys(object) { function shimKeys(object) {
var keyIndex, var props = keysIn(object),
index = -1,
props = keysIn(object),
length = props.length, length = props.length,
objLength = length && object.length, objLength = length && object.length,
maxIndex = objLength - 1, support = lodash.support;
result = [];
var allowIndexes = typeof objLength == 'number' && objLength > 0 && var allowIndexes = typeof objLength == 'number' && objLength > 0 &&
(isArray(object) || (support.nonEnumStrings && isString(object)) || (isArray(object) || (support.nonEnumStrings && isString(object)) ||
(support.nonEnumArgs && isArguments(object))); (support.nonEnumArgs && isArguments(object)));
var keyIndex,
index = -1,
maxIndex = objLength - 1,
result = [];
while (++index < length) { while (++index < length) {
var key = props[index]; var key = props[index];
if ((allowIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex <= maxIndex && keyIndex % 1 == 0)) || if ((allowIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex <= maxIndex && keyIndex % 1 == 0)) ||
@@ -3190,7 +3194,7 @@
if (!(typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER)) { if (!(typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER)) {
return values(value); return values(value);
} }
if (support.unindexedChars && isString(value)) { if (lodash.support.unindexedChars && isString(value)) {
return value.split(''); return value.split('');
} }
return isObject(value) ? value : Object(value); return isObject(value) ? value : Object(value);
@@ -3204,7 +3208,7 @@
* @returns {Object} Returns the object. * @returns {Object} Returns the object.
*/ */
function toObject(value) { function toObject(value) {
if (support.unindexedChars && isString(value)) { if (lodash.support.unindexedChars && isString(value)) {
var index = -1, var index = -1,
length = value.length, length = value.length,
result = Object(value); result = Object(value);
@@ -5754,7 +5758,7 @@
function toArray(collection) { function toArray(collection) {
var length = collection ? collection.length : 0; var length = collection ? collection.length : 0;
if (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER) { if (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER) {
return (support.unindexedChars && isString(collection)) return (lodash.support.unindexedChars && isString(collection))
? collection.split('') ? collection.split('')
: baseSlice(collection); : baseSlice(collection);
} }
@@ -6869,7 +6873,7 @@
*/ */
function isElement(value) { function isElement(value) {
return (value && typeof value == 'object' && value.nodeType === 1 && return (value && typeof value == 'object' && value.nodeType === 1 &&
(support.nodeClass ? toString.call(value).indexOf('Element') > -1 : isHostObject(value))) || false; (lodash.support.nodeClass ? toString.call(value).indexOf('Element') > -1 : isHostObject(value))) || false;
} }
// fallback for environments without DOM support // fallback for environments without DOM support
if (!support.dom) { if (!support.dom) {
@@ -7210,7 +7214,7 @@
* // => true * // => true
*/ */
var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) {
if (!(value && toString.call(value) == objectClass) || (!support.argsClass && isArguments(value))) { if (!(value && toString.call(value) == objectClass) || (!lodash.support.argsClass && isArguments(value))) {
return false; return false;
} }
var valueOf = value.valueOf, var valueOf = value.valueOf,
@@ -7703,7 +7707,7 @@
} }
if ((typeof Ctor == 'function' && Ctor.prototype === object) || if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
(typeof length == 'number' && length > 0) || (typeof length == 'number' && length > 0) ||
(support.enumPrototypes && typeof object == 'function')) { (lodash.support.enumPrototypes && typeof object == 'function')) {
return shimKeys(object); return shimKeys(object);
} }
return isObject(object) ? nativeKeys(object) : []; return isObject(object) ? nativeKeys(object) : [];
@@ -7759,7 +7763,9 @@
if (!isObject(object)) { if (!isObject(object)) {
object = Object(object); object = Object(object);
} }
var length = object.length; var length = object.length,
support = lodash.support;
length = (typeof length == 'number' && length > 0 && length = (typeof length == 'number' && length > 0 &&
(isArray(object) || (support.nonEnumStrings && isString(object)) || (isArray(object) || (support.nonEnumStrings && isString(object)) ||
(support.nonEnumArgs && isArguments(object))) && length) || 0; (support.nonEnumArgs && isArguments(object))) && length) || 0;