Download react-hook-form/src/utils/insert.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 450 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/utils/insert.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/utils/insert.ts
-
curl -L -o insert.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/utils/insert.ts
450 Bytes
| import convertToArrayPayload from './convertToArrayPayload'; | |
| export default function insert<T>(data: T[], index: number): (T | undefined)[]; | |
| export default function insert<T>( | |
| data: T[], | |
| index: number, | |
| value: T | T[], | |
| ): T[]; | |
| export default function insert<T>( | |
| data: T[], | |
| index: number, | |
| value?: T | T[], | |
| ): (T | undefined)[] { | |
| return [ | |
| ...data.slice(0, index), | |
| ...convertToArrayPayload(value), | |
| ...data.slice(index), | |
| ]; | |
| } | |