mirror of
https://github.com/ritz078/transform.git
synced 2026-12-03 21:40:06 +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
23 lines
530 B
TypeScript
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"}
|
|
/>
|
|
);
|
|
}
|