UNPKG

bbo

Version:

bbo is a utility library of zero dependencies for javascript.

20 lines (15 loc) 420 B
import hasOwnProperty from './has_own_property.js'; function search(needle, haystack, argStrict) { var strict = !!argStrict; var key = ''; for (key in haystack) { if (hasOwnProperty(haystack, key)) { // eslint-disable-next-line eqeqeq if (strict && haystack[key] === needle || !strict && haystack[key] == needle) { return key; } } } return false; } export default search;