mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 19:37:49 +00:00
Cleanup fromIndex coercions.
This commit is contained in:
@@ -276,7 +276,7 @@
|
|||||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||||
*/
|
*/
|
||||||
function baseIndexOf(array, value, fromIndex) {
|
function baseIndexOf(array, value, fromIndex) {
|
||||||
var index = (+fromIndex || 0) - 1,
|
var index = (fromIndex || 0) - 1,
|
||||||
length = array ? array.length : 0;
|
length = array ? array.length : 0;
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
@@ -1430,7 +1430,7 @@
|
|||||||
* @returns {Array} Returns the new flattened array.
|
* @returns {Array} Returns the new flattened array.
|
||||||
*/
|
*/
|
||||||
function baseFlatten(array, isShallow, isStrict, fromIndex) {
|
function baseFlatten(array, isShallow, isStrict, fromIndex) {
|
||||||
var index = (+fromIndex || 0) - 1,
|
var index = (fromIndex || 0) - 1,
|
||||||
length = array ? array.length : 0,
|
length = array ? array.length : 0,
|
||||||
result = [];
|
result = [];
|
||||||
|
|
||||||
@@ -3615,7 +3615,7 @@
|
|||||||
*/
|
*/
|
||||||
function contains(collection, target, fromIndex) {
|
function contains(collection, target, fromIndex) {
|
||||||
var length = collection ? collection.length : 0;
|
var length = collection ? collection.length : 0;
|
||||||
fromIndex = (typeof fromIndex == 'number' && +fromIndex) || 0;
|
fromIndex = (typeof fromIndex == 'number' && fromIndex) || 0;
|
||||||
|
|
||||||
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
|
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
|
||||||
if (typeof collection == 'string' || !isArray(collection) && isString(collection)) {
|
if (typeof collection == 'string' || !isArray(collection) && isString(collection)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user