mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-24 07:37:10 +00:00
Parse and stringify JSON with comments (#187)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { DataModel, ModelPath } from '@mcschema/core'
|
||||
import json from 'comment-json'
|
||||
import yaml from 'js-yaml'
|
||||
import { useCallback, useEffect, useRef, useState } from 'preact/hooks'
|
||||
import { Btn, BtnMenu } from '..'
|
||||
@@ -23,8 +24,8 @@ const FORMATS: Record<string, {
|
||||
stringify: (v: any, indentation: string | number | undefined) => string,
|
||||
}> = {
|
||||
json: {
|
||||
parse: JSON.parse,
|
||||
stringify: (v, i) => JSON.stringify(v, null, i),
|
||||
parse: json.parse,
|
||||
stringify: (v, i) => json.stringify(v, null, i),
|
||||
},
|
||||
yaml: {
|
||||
parse: yaml.load,
|
||||
|
||||
Reference in New Issue
Block a user