UNPKG

@theoplayer/react-native-engage

Version:
17 lines (14 loc) 377 B
export function arrayRemoveElement<T>(array: T[], element: T): boolean { const index = array.indexOf(element); if (index === -1) { return false; } arrayRemoveAt(array, index); return true; } export function arrayRemoveAt<T>(array: T[], index: number): void { array.splice(index, 1); } export function emptyArray<T>(source: T[]): void { source.length = 0; }