mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-18 22:25:44 +01:00
Answer principles round 1: 1 🔴, 5 🟡 (0 misread); the document carry's line feeds checked, element spellings shared with the writer, carried JSON bounded by type, an edit to a carry refused, one test per case, a start tag read one attribute at a time
This commit is contained in:
@@ -61,11 +61,11 @@ function readCarriedJson(raw: string, spelling: JsonSpelling, levels: number, ty
|
||||
const typed = type === undefined || type === '' ? { value } : typedValue(value, type)
|
||||
if (typed.fault !== undefined) return typed
|
||||
const nested = carriedNesting(typed.value, levels)
|
||||
if (nested !== undefined) return { fault: nested }
|
||||
if (nested.fault !== undefined) return nested
|
||||
if (!spellsCanonicalJson(value, spelling, raw)) {
|
||||
return { fault: unsupportedNodeShape(`${carryHolder} spells its node's JSON canonically: ${spelling === 'compact' ? 'compact' : 'two-space indent'}, keys sorted; ${wayOut}`) }
|
||||
}
|
||||
const node = carriedNode(typed.value, carryHolder)
|
||||
const node = carriedNode(nested.value, carryHolder)
|
||||
return node.fault === undefined ? node : { fault: { ...node.fault, message: `${node.fault.message}; ${wayOut}` } }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user