react-component-metadata-fix
parse react components for prop data and descriptions
Last updated 3 years ago by isaiah .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install react-component-metadata-fix 
SYNC missed versions from official npm registry.

react-component-metadata

parse react components for prop data and descriptions as well as leading comments

Install

npm i -S react-component-metadata

Use

var metadata = require('react-component-metadata')
var fs = require('fs')

var result = metadata(fs.readFileSync('./Modal.jsx', 'utf8'), options)

result will be an object hash with component names as keys

{
    // component name is either the Identifier name, displayName, the value of the @alias or @name doclet if it exists.
    Modal: {
        desc: 'A modal component' //the component leading comment
        props: {
            show: {
              type: { name: 'object' },
              required: false,
              desc: 'Show or hide the modal Component.' //the prop type leading comment
            }
        }
    }
}

You can also use metadata.parseDoclets to parse the JSDoc values out of the comments.

Options

  • mixins: default false, Parse Mixins as components, will have an additional mixin: true property on the component metadata. Setting this to true will also try and parse mixins in createClass components and add them to the mixins property.

Current Tags

  • 3.1.2                                ...           latest (3 years ago)

2 Versions

  • 3.1.2                                ...           3 years ago
  • 3.1.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (4)
Dev Dependencies (15)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |