element-prop-types
Advanced tools
Comparing version 1.0.0 to 1.0.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var PropTypes = require("prop-types"); | ||
exports.default = function (element) { return PropTypes.shape({ type: PropTypes.oneOf([element]) }); }; | ||
var elementOf = function (element) { return PropTypes.shape({ type: PropTypes.oneOf([element]) }); }; | ||
exports.default = { elementOf: elementOf }; |
{ | ||
"name": "element-prop-types", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "React PropTypes for props-elements", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# element-prop-types | ||
React PropTypes for props-elements | ||
[![npm](https://img.shields.io/npm/v/element-prop-types.svg)](https://www.npmjs.com/package/element-prop-types) | ||
[![npm](https://img.shields.io/npm/dt/element-prop-types.svg)](https://www.npmjs.com/package/element-prop-types) | ||
[![GitHub license](https://img.shields.io/github/license/ardalanamini/element-prop-types.svg)](https://github.com/ardalanamini/element-prop-types/blob/master/LICENSE) | ||
## Install | ||
@@ -23,4 +27,4 @@ | ||
Modal.propTypes = { | ||
header: ElementPropTypes(Header).isRequired, | ||
items: PropTypes.arrayOf(ElementPropTypes(Item)) | ||
header: ElementPropTypes.elementOf(Header).isRequired, | ||
items: PropTypes.arrayOf(ElementPropTypes.elementOf(Item)) | ||
}; | ||
@@ -44,4 +48,4 @@ | ||
### `ElementPropTypes(Component)` | ||
### `elementOf(Component)` | ||
checks the type of a React element |
import * as React from 'react' | ||
import * as PropTypes from 'prop-types' | ||
export default (element: React.ReactNode) => PropTypes.shape({type: PropTypes.oneOf([element])}) | ||
const elementOf = (element: React.ReactNode) => PropTypes.shape({ type: PropTypes.oneOf([element]) }) | ||
export default { elementOf } |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3487
10
50