@theoplayer/react-native-engage
Version:
Engage connector for @theoplayer/react-native
17 lines (14 loc) • 377 B
text/typescript
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;
}