Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

gwyneplaine/kind2string

Repository files navigation

The code for this package has been moved

To make a better unified dev loop, this package has been added to a monorepo for packages that work with extract-react-types. Future work will continue from there.

Kind 2 String - a parser for extract-react-types

Kind 2 String is designed to take the data structures outputted by extract-react-types and convert it down to a (useful) string, as well as performing safe traversal through the output of extract-react-types so that trying to display information in your docs does not throw errors.

It exposes a convert method which allows you to ensure the data structure resolves to a string. It also exposes its converter object, allowing you to overwrite converters of your choice, if you wish to perform some other action other than the default string converter.

Default use-case:

import generatedData from './extract-react-type-write-location';
import convert from 'kind2string';

export default () => <div>convert(generatedData)</div>;

Also, if you are handling the kinds in a custom way, it is good to pass the final kind to kind2string, to ensure that you always pass a string to your react components.

For examples of how to use this, the @atlaskit/docs is this package. A good pattern on how to implement kind2string can be found in the prettyproptypes file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published