Files
transform/pages/toml-to-yaml.tsx
Nasrul Faizin 3ba8b163a3 add YAML to TOML and TOML to YAML (#301)
* add JSON to TOML

* change function name to JsonToToml

* add TOML to JSON

* add package iarna-toml

* feat: add YAML to TOML

* feat: add TOML to YAML

* chore(yaml-to-toml): change func name
2021-09-04 18:56:40 +05:30

23 lines
530 B
TypeScript

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