3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-19 14:45:44 +01:00

Read the three directive forms, their attributes and the fences that nest them

This commit is contained in:
2026-09-01 08:12:03 +02:00
parent cc794d541e
commit d54f72ea51
24 changed files with 581 additions and 89 deletions
+4 -2
View File
@@ -2,6 +2,7 @@ export type ConvertErrorCode =
| 'malformed-directive'
| 'malformed-pipe-table'
| 'not-an-adf-document'
| 'unknown-directive-name'
| 'unmappable-html'
| 'unmappable-image'
| 'unspellable-adjacent-lists'
@@ -17,12 +18,13 @@ export type ConvertErrorCode =
export type ConvertErrorPath = readonly (number | string)[]
export type ConvertError = {
export type ConvertFault = {
code: ConvertErrorCode
message: string
path: ConvertErrorPath
}
export type ConvertError = ConvertFault & { path: ConvertErrorPath }
export type Result<T> = { error: ConvertError; ok: false } | { ok: true; value: T }
export function failure<T>(code: ConvertErrorCode, message: string, path: ConvertErrorPath): Result<T> {