mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Cleanup and formatting pass.
This commit is contained in:
32
lodash.js
32
lodash.js
@@ -2495,7 +2495,8 @@
|
|||||||
if (object == null) {
|
if (object == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return object[key] === value && (value !== undefined || (key in Object(object)));
|
return object[key] === value &&
|
||||||
|
(value !== undefined || (key in Object(object)));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return function(object) {
|
return function(object) {
|
||||||
@@ -3617,9 +3618,9 @@
|
|||||||
* @returns {string} Returns the padding for `string`.
|
* @returns {string} Returns the padding for `string`.
|
||||||
*/
|
*/
|
||||||
function createPadding(string, length, chars) {
|
function createPadding(string, length, chars) {
|
||||||
var strLength = stringSize(string);
|
|
||||||
length = toInteger(length);
|
length = toInteger(length);
|
||||||
|
|
||||||
|
var strLength = stringSize(string);
|
||||||
if (!length || strLength >= length) {
|
if (!length || strLength >= length) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -3679,7 +3680,7 @@
|
|||||||
function createRound(methodName) {
|
function createRound(methodName) {
|
||||||
var func = Math[methodName];
|
var func = Math[methodName];
|
||||||
return function(number, precision) {
|
return function(number, precision) {
|
||||||
precision = toInteger(precision);
|
precision = precision ? toInteger(precision) : 0;
|
||||||
if (precision) {
|
if (precision) {
|
||||||
precision = pow(10, precision);
|
precision = pow(10, precision);
|
||||||
return func(number * precision) / precision;
|
return func(number * precision) / precision;
|
||||||
@@ -4951,11 +4952,11 @@
|
|||||||
if (!length) {
|
if (!length) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (fromIndex) {
|
fromIndex = fromIndex ? toInteger(fromIndex) : 0;
|
||||||
fromIndex = toInteger(fromIndex);
|
if (fromIndex < 0) {
|
||||||
fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
|
fromIndex = nativeMax(length + fromIndex, 0);
|
||||||
}
|
}
|
||||||
return baseIndexOf(array, value, fromIndex || 0);
|
return baseIndexOf(array, value, fromIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -8337,7 +8338,8 @@
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isBoolean(value) {
|
function isBoolean(value) {
|
||||||
return value === true || value === false || (isObjectLike(value) && objToString.call(value) == boolTag);
|
return value === true || value === false ||
|
||||||
|
(isObjectLike(value) && objToString.call(value) == boolTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -8493,7 +8495,8 @@
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isError(value) {
|
function isError(value) {
|
||||||
return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag;
|
return isObjectLike(value) &&
|
||||||
|
typeof value.message == 'string' && objToString.call(value) == errorTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -8746,7 +8749,8 @@
|
|||||||
if (isFunction(value)) {
|
if (isFunction(value)) {
|
||||||
return reIsNative.test(fnToString.call(value));
|
return reIsNative.test(fnToString.call(value));
|
||||||
}
|
}
|
||||||
return isObjectLike(value) && (isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
|
return isObjectLike(value) &&
|
||||||
|
(isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -8815,7 +8819,8 @@
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isNumber(value) {
|
function isNumber(value) {
|
||||||
return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag);
|
return typeof value == 'number' ||
|
||||||
|
(isObjectLike(value) && objToString.call(value) == numberTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -10654,9 +10659,10 @@
|
|||||||
* // => ''
|
* // => ''
|
||||||
*/
|
*/
|
||||||
function repeat(string, n) {
|
function repeat(string, n) {
|
||||||
var result = '';
|
|
||||||
string = baseToString(string);
|
string = baseToString(string);
|
||||||
n = toInteger(n);
|
n = toInteger(n);
|
||||||
|
|
||||||
|
var result = '';
|
||||||
if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
|
if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -12339,7 +12345,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
LazyWrapper.prototype.slice = function(start, end) {
|
LazyWrapper.prototype.slice = function(start, end) {
|
||||||
start = start == null ? 0 : toInteger(start);
|
start = start ? toInteger(start) : 0;
|
||||||
|
|
||||||
var result = this;
|
var result = this;
|
||||||
if (result.__filtered__ && (start > 0 || end < 0)) {
|
if (result.__filtered__ && (start > 0 || end < 0)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user