Download node_modules/@hookform/resolvers/io-ts/src/arrayToPath.ts from metarm/QMetaRam: direct link, hf CLI and curl.
- Browser
- Download file 431 Bytes
-
https://huggingface.co/metarm/QMetaRam/resolve/main/node_modules/%40hookform/resolvers/io-ts/src/arrayToPath.ts
- Command line
-
hf download hf://metarm/QMetaRam/node_modules/@hookform/resolvers/io-ts/src/arrayToPath.ts
-
curl -L -o arrayToPath.ts https://huggingface.co/metarm/QMetaRam/resolve/main/node_modules/%40hookform/resolvers/io-ts/src/arrayToPath.ts
431 Bytes
| import * as Either from 'fp-ts/Either'; | |
| import { pipe } from 'fp-ts/function'; | |
| const arrayToPath = (paths: Either.Either<string, number>[]): string => | |
| paths.reduce( | |
| (previous, path, index) => | |
| pipe( | |
| path, | |
| Either.fold( | |
| (key) => `${index > 0 ? '.' : ''}${key}`, | |
| (key) => `[${key}]`, | |
| ), | |
| (path) => `${previous}${path}`, | |
| ), | |
| '', | |
| ); | |
| export default arrayToPath; | |