MCPcopy Create free account
hub / github.com/react-hook-form/react-hook-form / removeAtIndexes

Function removeAtIndexes

src/utils/remove.ts:5–15  ·  view source on GitHub ↗
(data: T[], indexes: number[])

Source from the content-addressed store, hash-verified

3import isUndefined from './isUndefined';
4
5function removeAtIndexes<T>(data: T[], indexes: number[]): T[] {
6 let i = 0;
7 const temp = [...data];
8
9 for (const index of indexes) {
10 temp.splice(index - i, 1);
11 i++;
12 }
13
14 return compact(temp).length ? temp : [];
15}
16
17export default <T>(data: T[], index?: number | number[]): T[] =>
18 isUndefined(index)

Callers 1

remove.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected