3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-18 22:25:44 +01:00

Share the CommonMark grammar, close the guard's hole, refuse the lists no marker spells

This commit is contained in:
2026-08-24 16:18:47 +02:00
parent 3f73497a6f
commit e03a351d45
14 changed files with 205 additions and 126 deletions
+10
View File
@@ -0,0 +1,10 @@
export type JsonValue = JsonValue[] | boolean | null | number | string | { [key: string]: JsonValue }
export function isJsonValue(value: unknown): value is JsonValue {
if (value === null) return true
if (typeof value === 'boolean' || typeof value === 'string') return true
if (typeof value === 'number') return Number.isFinite(value)
if (Array.isArray(value)) return [...value].every(isJsonValue)
if (typeof value === 'object') return Object.values(value).every(isJsonValue)
return false
}