(input: string)
| 566 | * @since 4.0.0 |
| 567 | */ |
| 568 | export const parse = (input: string): Result.Result<Record<string, unknown>, EncodingError> => { |
| 569 | try { |
| 570 | return Result.succeed(new TomlParser(input.replace(/^\uFEFF/, "")).parse()) |
| 571 | } catch (e) { |
| 572 | return Result.fail( |
| 573 | new EncodingError({ |
| 574 | module: "Toml", |
| 575 | kind: "Decode", |
| 576 | input, |
| 577 | message: e instanceof Error ? e.message : "Invalid input" |
| 578 | }) |
| 579 | ) |
| 580 | } |
| 581 | } |