( text: string, path: ReadonlyArray<string>, primitive: Config.Config.Primitive<A>, delimiter: string, split: boolean )
| 620 | } |
| 621 | |
| 622 | const parsePrimitive = <A>( |
| 623 | text: string, |
| 624 | path: ReadonlyArray<string>, |
| 625 | primitive: Config.Config.Primitive<A>, |
| 626 | delimiter: string, |
| 627 | split: boolean |
| 628 | ): Effect.Effect<Array<A>, ConfigError.ConfigError> => { |
| 629 | if (!split) { |
| 630 | return pipe( |
| 631 | primitive.parse(text), |
| 632 | core.mapBoth({ |
| 633 | onFailure: configError.prefixed(path), |
| 634 | onSuccess: Arr.of |
| 635 | }) |
| 636 | ) |
| 637 | } |
| 638 | return pipe( |
| 639 | splitPathString(text, delimiter), |
| 640 | core.forEachSequential((char) => primitive.parse(char.trim())), |
| 641 | core.mapError(configError.prefixed(path)) |
| 642 | ) |
| 643 | } |
| 644 | |
| 645 | const transpose = <A>(array: ReadonlyArray<ReadonlyArray<A>>): Array<Array<A>> => { |
| 646 | return Object.keys(array[0]).map((column) => array.map((row) => row[column as any])) |
no test coverage detected