<commit_before># react-custom-proptypes
[![npm](https://img.shields.io/npm/v/react-custom-proptypes.svg)](https://www.npmjs.com/package/react-custom-proptypes)
[![Build Status](https://travis-ci.org/jackrzhang/react-custom-proptypes.svg?branch=master)](https://travis-ci.org/jackrzhang/react-custom-proptypes)
[![dependencies Status](https://david-dm.org/jackrzhang/react-custom-proptypes/status.svg)](https://david-dm.org/jackrzhang/react-custom-proptypes)

React Custom PropTypes exposes a simple API for creating **precisely defined**, **dependency-free**, and **chainable** React PropType validators.

Check out the [examples](https://github.com/jackrzhang/react-custom-proptypes/blob/master/examples) for various use cases.

## Installation
```sh
$ npm install react react-dom react-custom-proptypes --save
```

## createPropType
### Syntax
```
createPropType(callback[, description])
```

### Parameters
##### `callback` : function
Function that returns a boolean representing the validation of the proptype, taking a single argument: `prop`, the value of the prop

##### `description` : string
Optional. Use this value to specify a helpful description.

### Usage
```jsx
import React from 'react';
import { createPropType } from './../../lib/custom-proptypes';

const Card = props => (
  <div>
    <div>{props.suit}</div>
    <div>{props.value}</div>
  </div>
);

const suitPropType = createPropType(
  prop =>
    prop === 'spades' ||
    prop === 'hearts' ||
    prop === 'diamonds' ||
    prop === 'clubs',
  'Must be `spades`, `hearts`, `diamonds`, or `clubs`.'
);<commit_msg>Correct import statement in createPropType usage example<commit_after># react-custom-proptypes
[![npm](https://img.shields.io/npm/v/react-custom-proptypes.svg)](https://www.npmjs.com/package/react-custom-proptypes)
[![Build Status](https://travis-ci.org/jackrzhang/react-custom-proptypes.svg?branch=master)](https://travis-ci.org/jackrzhang/react-custom-proptypes)
[![dependencies Status](https://david-dm.org/jackrzhang/react-custom-proptypes/status.svg)](https://david-dm.org/jackrzhang/react-custom-proptypes)

React Custom PropTypes exposes a simple API for creating **precisely defined**, **dependency-free**, and **chainable** React PropType validators.

Check out the [examples](https://github.com/jackrzhang/react-custom-proptypes/blob/master/examples) for various use cases.

## Installation
```sh
$ npm install react react-dom react-custom-proptypes --save
```

## createPropType
### Syntax
```
createPropType(callback[, description])
```

### Parameters
##### `callback` : function
Function that returns a boolean representing the validation of the proptype, taking a single argument: `prop`, the value of the prop

##### `description` : string
Optional. Use this value to specify a helpful description.

### Usage
```jsx
import React from 'react';
import { createPropType } from 'react-custom-proptypes';

const Card = props => (
  <div>
    <div>{props.suit}</div>
    <div>{props.value}</div>
  </div>
);

const suitPropType = createPropType(
  prop =>
    prop === 'spades' ||
    prop === 'hearts' ||
    prop === 'diamonds' ||
    prop === 'clubs',
  'Must be `spades`, `hearts`, `diamonds`, or `clubs`.'
);
{'fraction_non_alphanumeric': 0.1719090625973217, 'fraction_numerical': 0.0, 'mean_word_length': 4.85063752276867, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, 'https://': 14, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1706532', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1027, 'n_words': 236}