json2ts-core

0.1.1 • Public • Published

Json2ts

Automatically generate Typescript Definition file from url

Install

npm install json2ts-core --save-dev

Usage(CLI)

json2ts -u=your-web-url
--version       Show version number                                   [boolean]
  -u, --url       your web url                                        [required]
  -m, --method    your web url method                           [default: "get"]
  -t, --target    typescript interface target folder path       [default: "./interface"]
  -p, --property  export response property interface
  -h, --help      Show help                                           [boolean]

Usage(API)

const json2ts = require('json2ts-core/src/json2ts')
 
json2ts({url: 'http://localhost:8002'}, ($) => {
  // url from page to generate ts
  // save method and url for each item
  $('selector').each(function(index, element) {
    ...
  })
  return arr
})

License

The code is distributed under the MIT license

Readme

Keywords

Package Sidebar

Install

npm i json2ts-core

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

12.5 kB

Total Files

10

Last publish

Collaborators

  • springleo