CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
_createFind.js26 linesDownload Raw Back to lodash
1var baseIteratee = require('./_baseIteratee'),2    isArrayLike = require('./isArrayLike'),3    keys = require('./keys');4 5/**6 * Creates a `_.find` or `_.findLast` function.7 *8 * @private9 * @param {Function} findIndexFunc The function to find the collection index.10 * @returns {Function} Returns the new find function.11 */12function createFind(findIndexFunc) {13  return function(collection, predicate, fromIndex) {14    var iterable = Object(collection);15    if (!isArrayLike(collection)) {16      var iteratee = baseIteratee(predicate, 3);17      collection = keys(collection);18      predicate = function(key) { return iteratee(iterable[key], key, iterable); };19    }20    var index = findIndexFunc(collection, predicate, fromIndex);21    return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;22  };23}24 25module.exports = createFind;26 
basant307/AI_Governance_Project · CoolFace