1.0.7 • Published 3 years ago

json2tstool v1.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

转换JSON字符串为TypeScript Interface字符串

demo 演示

json2tsDEMO

安装

npm i json2tstool

使用

In Browser

<script src="https://unpkg.com/json2tstool@1.0.0/dist/index.global.js"></script>

const jsonStr = `{ "key" : 2 }`;

json2tstool.default(jsonStr);

ES Module

import json2ts from 'json2tstool';

const jsonStr = `{ "key" : 2 }`;

json2ts(jsonStr);

NodeJS

const json2ts = require('json2tstool');

const jsonStr = `{ "key" : 2 }`;

json2ts(jsonStr);

命令行

# 输入json字符串
json2ts -i '{ "key" : 2 }'

# 指定输入文件地址
json2ts -f 'path to your json'

# 指定输出文件地址
json2ts -o 'a.ts'

支持一下

如果该库对你有帮助,可以点一下 ⭐️!

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago