You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
376 B
11 lines
376 B
var findKey = require('./findKey'); |
|
var findIdx = require('./findIdx'); |
|
var isArrLike = require('./isArrLike'); |
|
var isUndef = require('./isUndef'); |
|
exports = function(obj, predicate, ctx) { |
|
var keyFinder = isArrLike(obj) ? findIdx : findKey; |
|
var key = keyFinder(obj, predicate, ctx); |
|
if (!isUndef(key) && key !== -1) return obj[key]; |
|
}; |
|
|
|
module.exports = exports;
|
|
|