Skip to content

Commit

Permalink
Re-add json:number formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
NeunEinser committed May 17, 2024
1 parent fdfc1fb commit c742b6d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/json/src/formatter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,17 @@ const object: Formatter<JsonObjectNode> = (node, ctx) => {
return `{\n${fields.join(',\n')}\n${ctx.indent()}}`
}

const number: Formatter<JsonNumberNode> = (node, ctx) =>
ctx.meta.getFormatter(node.value.type)(node.value, ctx)

export function register(meta: MetaRegistry): void {
meta.registerFormatter<JsonArrayNode>('json:array', array)
meta.registerFormatter<JsonBooleanNode>(
'json:boolean',
core.formatter.boolean,
)
meta.registerFormatter<JsonNullNode>('json:null', () => 'null')
meta.registerFormatter<JsonNumberNode>('json:number', number)
meta.registerFormatter<JsonObjectNode>('json:object', object)
meta.registerFormatter<JsonStringNode>('json:string', core.formatter.string)
}

0 comments on commit c742b6d

Please sign in to comment.