prop-types-falsy

0.1.0 • Public • Published

prop-types-falsy

npm

Installation

npm install prop-types-falsy

Usage

const falsy = require('prop-types-falsy');
 
MyComponent.propTypes = {
  items: PropTypes.arrayOf([
    PropTypes.oneOfType([
      PropTypes.shape({
        x: PropTypes.string.isRequired,
        y: PropTypes.number.isRequired,
      }),
      falsy,
    ]),
  ]).isRequired,
};
 
<MyComponent
  items={[
    {
      x: 'hello',
      y: 10,
    },
    isXxxx && {
      x: 'cool',
      y: 100,
    },
    myItems.length && {
      x: 'wow',
      y: 1000,
    },
  ]}
/>;

License

MIT © C.T.Lin

Readme

Keywords

Package Sidebar

Install

npm i prop-types-falsy

Weekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

110 kB

Total Files

8

Last publish

Collaborators

  • chentsulin