UNPKG

@theoplayer/react-native-ui

Version:

A React Native UI for @theoplayer/react-native

28 lines (27 loc) 772 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.arrayFind = void 0; exports.arrayRemoveAt = arrayRemoveAt; exports.arrayRemoveElement = arrayRemoveElement; function arrayRemoveElement(array, element) { const index = array.indexOf(element); if (index === -1) { return false; } arrayRemoveAt(array, index); return true; } function arrayRemoveAt(array, index) { array.splice(index, 1); } const arrayFind = exports.arrayFind = typeof Array.prototype.find === 'function' ? (array, predicate) => array.find(predicate) : (array, predicate) => { for (let i = 0; i < array.length; i++) { if (predicate(array[i], i, array)) { return array[i]; } } return undefined; }; //# sourceMappingURL=ArrayUtils.js.map