Files
transform/pages/toml-to-json.tsx
Nasrul Faizin baa447348c add json to toml and toml to json (#299)
* add JSON to TOML

* change function name to JsonToToml

* add TOML to JSON

* add package iarna-toml
2021-08-30 00:42:09 +05:30

22 lines
505 B
TypeScript

import ConversionPanel from "@components/ConversionPanel";
import { useCallback } from "react";
import * as React from "react";
import { parse } from "@iarna/toml";
export default function TomlToJson() {
const transformer = useCallback(
({ value }) => Promise.resolve(JSON.stringify(parse(value))),
[]
);
return (
<ConversionPanel
transformer={transformer}
editorTitle="TOML"
editorLanguage="toml"
resultTitle="JSON"
resultLanguage={"json"}
/>
);
}