react-attrs-filter

Filter React props

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
react-attrs-filter
800.1.29 years ago9 years agoMinified + gzip package size for react-attrs-filter in KB

Readme

npm travis coverage deps
Filter React props:
  • getPropsFor(tag)
  • filterPropsFor(props, tag)
  • filterPropsExcept(props, tag)

Install

npm i -S react-attrs-filter

Usage

import {
    getPropsFor,
    filterPropsFor,
    filterPropsExcept
} from 'react-attrs-filter';

console.log(
    getPropsFor('input')
);
// [ 'list', 'max', 'maxLength', 'min', 'multiple', … ]

console.log(
    filterPropsFor({ ololo: true, min: 0 }, 'input')
);
// { min: 0 }

console.log(
    filterPropsExcept({ ololo: true, min: 0 }, 'input')
);
// { ololo: true }

References

  • https://facebook.github.io/react/docs/tags-and-attributes.html
  • https://facebook.github.io/react/docs/events.html
  • https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes