( text: string, path: ReadonlyArray<string>, primitive: Config.Config.Primitive<A>, delimiter: string, split: boolean )
| 599 | } |
| 600 | |
| 601 | const parsePrimitive = <A>( |
| 602 | text: string, |
| 603 | path: ReadonlyArray<string>, |
| 604 | primitive: Config.Config.Primitive<A>, |
| 605 | delimiter: string, |
| 606 | split: boolean |
| 607 | ): Effect.Effect<Array<A>, ConfigError.ConfigError> => { |
| 608 | if (!split) { |
| 609 | return pipe( |
| 610 | primitive.parse(text), |
| 611 | core.mapBoth({ |
| 612 | onFailure: configError.prefixed(path), |
| 613 | onSuccess: Arr.of |
| 614 | }) |
| 615 | ) |
| 616 | } |
| 617 | return pipe( |
| 618 | splitPathString(text, delimiter), |
| 619 | core.forEachSequential((char) => primitive.parse(char.trim())), |
| 620 | core.mapError(configError.prefixed(path)) |
| 621 | ) |
| 622 | } |
| 623 | |
| 624 | const transpose = <A>(array: ReadonlyArray<ReadonlyArray<A>>): Array<Array<A>> => { |
| 625 | return Object.keys(array[0]).map((column) => array.map((row) => row[column as any])) |
no test coverage detected