@theoplayer/react-native-ui
Version:
A React Native UI for @theoplayer/react-native
20 lines • 577 B
JavaScript
export function arrayRemoveElement(array, element) {
const index = array.indexOf(element);
if (index === -1) {
return false;
}
arrayRemoveAt(array, index);
return true;
}
export function arrayRemoveAt(array, index) {
array.splice(index, 1);
}
export const 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