mirror of
https://github.com/ritz078/transform.git
synced 2026-11-21 00:32:56 +03:00
1 parent
0ea474c7c4
commit
e355a8b2d7
8 files changed
+131
-17
No files matched your search
@@ -12,6 +12,7 @@ require("codemirror/mode/rust/rust");
|
||||
require("codemirror/mode/sql/sql");
|
||||
require("codemirror/mode/clike/clike");
|
||||
require("codemirror/mode/go/go");
|
||||
require("codemirror/mode/yaml/yaml");
|
||||
|
||||
function noop() {}
|
||||
|
||||
|
||||
@@ -27,7 +27,9 @@ const modeMapping = {
|
||||
typescript: true
|
||||
},
|
||||
mysql: "text/x-mysql",
|
||||
scala: "text/x-scala"
|
||||
scala: "text/x-scala",
|
||||
jsx: "text/jsx",
|
||||
yaml: "text/x-yaml"
|
||||
};
|
||||
|
||||
type Props = {
|
||||
|
||||
+5
-3
@@ -49,6 +49,7 @@
|
||||
"json-schema-faker": "^0.5.0-rc11",
|
||||
"json-schema-to-typescript": "4.6.5",
|
||||
"json-ts": "^1.6.4",
|
||||
"json2yaml": "^1.1.0",
|
||||
"jsx-to-json": "^0.2.3",
|
||||
"lodash": "^4.17.4",
|
||||
"next": "5.1.0",
|
||||
@@ -60,7 +61,7 @@
|
||||
"react-codemirror2": "4.2.1",
|
||||
"react-content-loader": "^3.1.1",
|
||||
"react-dom": "16.2.0",
|
||||
"react-fuzzy-picker": "0.6.0",
|
||||
"react-fuzzy-picker": "0.7.0",
|
||||
"react-github-corner": "^2.1.0",
|
||||
"stringify-object": "^3.2.1",
|
||||
"transform-css-to-js": "^0.1.1",
|
||||
@@ -68,7 +69,8 @@
|
||||
"transform-json-types": "^0.4.0",
|
||||
"transform-svg-to-native": "^0.1.3",
|
||||
"unfetch": "^3.0.0",
|
||||
"xml-js": "^1.6.2"
|
||||
"xml-js": "^1.6.2",
|
||||
"yaml": "^0.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"all-contributors-cli": "^4.10.1",
|
||||
@@ -79,7 +81,7 @@
|
||||
"css-loader": "^0.28.7",
|
||||
"glob": "^7.1.2",
|
||||
"husky": "^0.14.3",
|
||||
"lint-staged": "^7.0.0",
|
||||
"lint-staged": "^7.0.1",
|
||||
"lodash-webpack-plugin": "^0.11.4",
|
||||
"prettier": "^1.9.2",
|
||||
"style-loader": "^0.20.3",
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import PoweredBy from "../components/PoweredBy";
|
||||
import { stringify } from "json2yaml";
|
||||
|
||||
const defaultText = `{
|
||||
"foo": "bar",
|
||||
"baz": [
|
||||
"qux",
|
||||
"quxx"
|
||||
],
|
||||
"corge": null,
|
||||
"grault": 1,
|
||||
"garply": true,
|
||||
"waldo": "false",
|
||||
"fred": "undefined",
|
||||
"emptyarr": []
|
||||
}`;
|
||||
|
||||
export default class extends PureComponent {
|
||||
getTransformedValue = code => stringify(JSON.parse(code));
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<ConversionPanel
|
||||
leftTitle="JSON"
|
||||
rightTitle="YAML"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
defaultText={defaultText}
|
||||
leftMode="json"
|
||||
rightMode="yaml"
|
||||
url={this.props.url}
|
||||
prettifyRightPanel={false}
|
||||
/>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ export default class extends PureComponent {
|
||||
rightTitle="JS Object"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
defaultText={defaultText}
|
||||
leftMode="html"
|
||||
leftMode="jsx"
|
||||
rightMode="json"
|
||||
url={this.props.url}
|
||||
/>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import React, { PureComponent } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import PoweredBy from "../components/PoweredBy";
|
||||
import yaml from "yaml";
|
||||
|
||||
const defaultText = `---
|
||||
foo: "bar"
|
||||
baz:
|
||||
- "qux"
|
||||
- "quxx"
|
||||
corge: null
|
||||
grault: 1
|
||||
garply: true
|
||||
waldo: "false"
|
||||
fred: "undefined"
|
||||
emptyarr: []
|
||||
emptyobj: {}
|
||||
`;
|
||||
|
||||
export default class extends PureComponent {
|
||||
getTransformedValue = code => JSON.stringify(yaml.eval(code));
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Layout pathname={this.props.url.pathname}>
|
||||
<ConversionPanel
|
||||
leftTitle="YAML"
|
||||
rightTitle="JSON"
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
defaultText={defaultText}
|
||||
leftMode="yaml"
|
||||
rightMode="json"
|
||||
url={this.props.url}
|
||||
/>
|
||||
<PoweredBy pathname={this.props.url.pathname} />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
}
|
||||
+16
-2
@@ -216,8 +216,8 @@ export const categorizedRoutes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
category: "XML",
|
||||
iconName: "icon-html",
|
||||
category: "Others",
|
||||
iconName: "",
|
||||
content: [
|
||||
{
|
||||
label: "XML to JSON",
|
||||
@@ -225,6 +225,20 @@ export const categorizedRoutes = [
|
||||
desc: "An online REPL to generate basic JSON from a XML.",
|
||||
packageName: "xml-js",
|
||||
packageUrl: "https://github.com/nashwaan/xml-js"
|
||||
},
|
||||
{
|
||||
label: "JSON to YAML",
|
||||
path: "/json-to-yaml",
|
||||
desc: "An online REPL to convert JSON to YAML.",
|
||||
packageName: "json2yaml",
|
||||
packageUrl: "https://github.com/jeffsu/json2yaml"
|
||||
},
|
||||
{
|
||||
label: "YAML to JSON",
|
||||
path: "/yaml-to-json",
|
||||
desc: "An online REPL to convert YAML to JSON.",
|
||||
packageName: "yaml",
|
||||
packageUrl: "https://github.com/tj/js-yaml"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -4347,6 +4347,12 @@ json-ts@^1.6.4:
|
||||
transducers-js "^0.4.174"
|
||||
typescript "^2.3.2"
|
||||
|
||||
json2yaml@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/json2yaml/-/json2yaml-1.1.0.tgz#5414d907f9816586b80c513ec2e3aeb2ab819a6c"
|
||||
dependencies:
|
||||
remedial "1.x"
|
||||
|
||||
json5@^0.5.0, json5@^0.5.1:
|
||||
version "0.5.1"
|
||||
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"
|
||||
@@ -4443,9 +4449,9 @@ lie@^3.0.2:
|
||||
dependencies:
|
||||
immediate "~3.0.5"
|
||||
|
||||
lint-staged@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-7.0.0.tgz#57926c63201e7bd38ca0576d74391efa699b4a9d"
|
||||
lint-staged@^7.0.1:
|
||||
version "7.0.1"
|
||||
resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-7.0.1.tgz#064321d79c2ab55808602f84f4ff94f52d872fd5"
|
||||
dependencies:
|
||||
app-root-path "^2.0.1"
|
||||
chalk "^2.3.1"
|
||||
@@ -4466,7 +4472,7 @@ lint-staged@^7.0.0:
|
||||
path-is-inside "^1.0.2"
|
||||
pify "^3.0.0"
|
||||
please-upgrade-node "^3.0.1"
|
||||
staged-git-files "1.1.0"
|
||||
staged-git-files "1.1.1"
|
||||
stringify-object "^3.2.2"
|
||||
|
||||
listr-silent-renderer@^1.1.1:
|
||||
@@ -6125,9 +6131,9 @@ react-dom@~15.4.1:
|
||||
loose-envify "^1.1.0"
|
||||
object-assign "^4.1.0"
|
||||
|
||||
react-fuzzy-picker@0.6.0:
|
||||
version "0.6.0"
|
||||
resolved "https://registry.yarnpkg.com/react-fuzzy-picker/-/react-fuzzy-picker-0.6.0.tgz#2d6855e345e7323f3e4e653d5584af3a3e36a348"
|
||||
react-fuzzy-picker@0.7.0:
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/react-fuzzy-picker/-/react-fuzzy-picker-0.7.0.tgz#8d7d2664762f5667e6652504b6015db76587c0d9"
|
||||
dependencies:
|
||||
classnames "^2.2.5"
|
||||
fuzzysearch "^1.0.3"
|
||||
@@ -6335,6 +6341,10 @@ regjsparser@^0.1.4:
|
||||
dependencies:
|
||||
jsesc "~0.5.0"
|
||||
|
||||
remedial@1.x:
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/remedial/-/remedial-1.0.7.tgz#d6674413a65676007be00dd400980987b2c300c1"
|
||||
|
||||
remove-trailing-separator@^1.0.1:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef"
|
||||
@@ -6878,9 +6888,9 @@ stackframe@^1.0.3:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.0.4.tgz#357b24a992f9427cba6b545d96a14ed2cbca187b"
|
||||
|
||||
staged-git-files@1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-1.1.0.tgz#1a9bb131c1885601023c7aaddd3d54c22142c526"
|
||||
staged-git-files@1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-1.1.1.tgz#37c2218ef0d6d26178b1310719309a16a59f8f7b"
|
||||
|
||||
static-extend@^0.1.1:
|
||||
version "0.1.2"
|
||||
@@ -7902,6 +7912,10 @@ yallist@^2.1.2:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
|
||||
|
||||
yaml@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/yaml/-/yaml-0.3.0.tgz#c31a616d07acdbc2012d73a6ba5b1b0bdd185a7f"
|
||||
|
||||
yargs-parser@^2.4.0, yargs-parser@^2.4.1:
|
||||
version "2.4.1"
|
||||
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-2.4.1.tgz#85568de3cf150ff49fa51825f03a8c880ddcc5c4"
|
||||
|
||||
Reference in new issue
Block a user