UNPKG

bbo

Version:

bbo is a utility library of zero dependencies for javascript.

22 lines (16 loc) 444 B
'use strict'; var has_own_property = require('./has_own_property.js'); function search(needle, haystack, argStrict) { var strict = !!argStrict; var key = ''; for (key in haystack) { if (has_own_property(haystack, key)) { // eslint-disable-next-line eqeqeq if (strict && haystack[key] === needle || !strict && haystack[key] == needle) { return key; } } } return false; } module.exports = search;