Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-to-jsdoc-converter

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-to-jsdoc-converter

```javascript import { JsonToJsdocConverter } from "json-to-jsdoc-converter"; ```

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
156
increased by105.26%
Maintainers
1
Weekly downloads
 
Created
Source

json-to-jsdoc-converter

How to use:

Import dependencies

import { JsonToJsdocConverter } from "json-to-jsdoc-converter";
Initialize converter
const converter = new JsonToJsdocConverter();
Provide some json
 {
  "id": 1,
  "name": "Super Mario",
  "age": null,
  "cars": [
    "honda",
    "bmw"
  ],
  "structure": {
    "logo": ""
  },
  "level1": {
    "alias": "testLevel",
    "level2": {
      "score": 12,
      "item": {},
      "level3": null
    }
  }
}
Pass the json to the convert method
const json: string = JSON.stringify(jsonMock1);
const jsDoc: string = converter.convert(json);
Use the jsDoc output
/**
* @typedef Type
* @property {number} id
* @property {string} name
* @property {any} [age]
* @property {string[]} cars
* @property {StructureType} structure
* @property {Level1Type} level1
*/

/**
* @typedef StructureType
* @property {string} logo
*/

/**
* @typedef Level1Type
* @property {string} alias
* @property {Level1Level2Type} level2
*/

/**
* @typedef Level1Level2Type
* @property {number} score
* @property {object} item
* @property {any} [level3]
*/

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Keywords

FAQs

Package last updated on 18 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc