@material-ui/popper.js
Version:
A fork of popper.js to avoid the deprecation warnings: https://github.com/mui-org/material-ui/issues/19358.
19 lines (17 loc) • 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];
}