Files
C4IT-F4SD-Collector/F4SDwebService/packages/popper.js.1.16.1/content/Scripts/src/utils/find.js
2025-11-11 11:12:05 +01:00

19 lines
397 B
JavaScript

/**
* Mimics the `find` method of Array
* @method
* @memberof Popper.Utils
* @argument {Array} arr
* @argument prop
* @argument value
* @returns index or -1
*/
export default function find(arr, check) {
// use native find if supported
if (Array.prototype.find) {
return arr.find(check);
}
// use `filter` to obtain the same behavior of `find`
return arr.filter(check)[0];
}