Sha256: 27547c5d02107f110a0bd3d03e0d22252affc5016ba46eb57efea1905827e85f

Contents?: true

Size: 927 Bytes

Versions: 167

Compression:

Stored size: 927 Bytes

Contents

/**
 * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`,
 * without support for callback shorthands and `this` binding, which iterates
 * over `collection` using the provided `eachFunc`.
 *
 * @private
 * @param {Array|Object|string} collection The collection to search.
 * @param {Function} predicate The function invoked per iteration.
 * @param {Function} eachFunc The function to iterate over `collection`.
 * @param {boolean} [retKey] Specify returning the key of the found element
 *  instead of the element itself.
 * @returns {*} Returns the found element or its key, else `undefined`.
 */
function baseFind(collection, predicate, eachFunc, retKey) {
  var result;
  eachFunc(collection, function(value, key, collection) {
    if (predicate(value, key, collection)) {
      result = retKey ? key : value;
      return false;
    }
  });
  return result;
}

module.exports = baseFind;

Version data entries

167 entries across 87 versions & 9 rubygems

Version Path
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseFind.js
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseFind.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseFind.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseFind.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseFind.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseFind.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/lodash/internal/baseFind.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseFind.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseFind.js
blackboard-3.1.9 lib/site_template/node_modules/easy-extender/node_modules/lodash/internal/baseFind.js
blackboard-3.1.9 lib/site_template/node_modules/opt-merger/node_modules/lodash/internal/baseFind.js
babel-schmooze-sprockets-0.1.1 node_modules/lodash/internal/baseFind.js
babel-schmooze-sprockets-0.1.0 node_modules/lodash/internal/baseFind.js
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseFind.js
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseFind.js
trusty-festivity-extension-2.5.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseFind.js
trusty-festivity-extension-2.5.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseFind.js
babel-schmooze-sprockets-0.1.0.alpha.3 node_modules/lodash/internal/baseFind.js
babel-schmooze-sprockets-0.1.0.alpha.2 node_modules/lodash/internal/baseFind.js
trusty-festivity-extension-2.5.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseFind.js