mirror of
https://github.com/ritz078/transform.git
synced 2026-12-02 21:28:56 +03:00
* 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
22 lines
525 B
TypeScript
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"}
|
|
/>
|
|
);
|
|
}
|