Files
transform/pages/yaml-to-toml.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

22 lines
525 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 YamlToToml() {
const transformer = useCallback(async ({ value }) => {
return toml.stringify(yaml.parse(value));
}, []);
return (
<ConversionPanel
transformer={transformer}
editorTitle="YAML"
editorLanguage="yaml"
resultTitle="TOML"
resultLanguage={"toml"}
/>
);
}