Add someObj.

This commit is contained in:
John-David Dalton
2017-04-02 22:06:59 -07:00
parent 1bdda20e49
commit 6543d3277e
4 changed files with 42 additions and 55 deletions

View File

@@ -1,22 +0,0 @@
/**
* A specialized version of `some` for arrays.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
let index = -1
const length = array == null ? 0 : array.length
while (++index < length) {
if (predicate(array[index], index, array)) {
return true
}
}
return false
}
export default arraySome

View File

@@ -1,22 +0,0 @@
import baseEach from './baseEach.js'
/**
* The base implementation of `some`.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function baseSome(collection, predicate) {
let result
baseEach(collection, (value, index, collection) => {
result = predicate(value, index, collection)
return !result
})
return !!result
}
export default baseSome