maycur-business
Version:
maycur business react components of web
21 lines (17 loc) • 386 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = find;
/**
* Ponyfill for Array.prototype.find
* @param {Array} arr
* @param {Function} checkFn
* @return item in the array
*/
function find(arr, checkFn) {
if (Array.prototype.find) {
return arr.find(checkFn);
} // use `filter` as fallback
return arr.filter(checkFn)[0];
}