react-attrs-filter
v0.1.2
Published
Filter React props
Readme
Filter React props:
getPropsFor(tag)filterPropsFor(props, tag)filterPropsExcept(props, tag)
Install
npm i -S react-attrs-filterUsage
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
