# proptypes

> React's PropTypes, packaged up as a standalone module.

Latest version **1.1.0** (published 2017-06-03) · BSD license · 0 weekly downloads

## Install

```sh
npm install proptypes
pnpm add proptypes
yarn add proptypes
bun add proptypes
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-06-03 |
| First published | 2015-10-20 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 60 |
| Maintainers | acdlite, developit |

## Links

- npm: https://www.npmjs.com/package/proptypes
- Repository: https://github.com/developit/proptypes
- Issues: https://github.com/developit/proptypes/issues
- npm.io page: https://npm.io/package/proptypes

## Recent versions

- 1.1.0 (latest) — 2017-06-03
- 1.0.0 — 2017-04-25
- 0.14.4 — 2017-02-03
- 0.14.3 — 2016-02-06
- 0.14.2 — 2016-02-06
- 0.14.1 — 2015-11-08
- 0.14.0 — 2015-10-20

## README

# proptypes

> React's [PropTypes], packaged up as a standalone module.

**DISCLAIMER:**
This is literally copied from the React 0.14 codebase.
If you're using PropTypes with React, it would be silly to reference this standalone version.


## Usage

```js
function check(props, propTypes) {
  for (let prop in propTypes) {
    if (propTypes.hasOwnProperty(prop)) {
      let err = propTypes[prop](props, prop, 'name', 'prop');
      if (err) {
        console.warn(err);
        return false;
      }
    }
  }
  return true;
}

let valid = check({
  a: 42,
  b: 'News'
}, {
  a: PropTypes.number,
  b: PropTypes.oneOf(['News', 'Photos'])
});

valid;  // true
```

## Production build

### Disabling

With webpack:

```js
module.exports = {
  resolve: {
    alias: {
      proptypes: 'proptypes/disabled',
    }
  }
};
```

### Removing the definitions with React 

When you are using this package with React like API, you might want to save bandwidth by removing the definitions.
You can use [babel-plugin-transform-react-remove-prop-types](https://github.com/oliviertassinari/babel-plugin-transform-react-remove-prop-types) for that use case, for instance:

```js
// In
const Baz = (props) => (
  <div {...props} />
);

Baz.propTypes = {
  className: PropTypes.string
};

// Out
const Baz = (props) => (
  <div {...props} />
);
```

## License

BSD

[PropTypes]: https://github.com/facebook/react/blob/master/src/isomorphic/classic/types/ReactPropTypes.js

---
_Source: https://npm.io/package/proptypes · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
