Created
February 6, 2018 21:26
-
-
Save maka-io/6644b8361f54b74d5cbcbf454ab59b0a to your computer and use it in GitHub Desktop.
Meteor React propTypes checker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Meteor.isDevelopment) { | |
checkProps = (propTypes, props) => { | |
let matchPropTypes = Object.keys(propTypes).every((a, index) => a === Object.keys(props)[index]) | |
if (!matchPropTypes) { | |
console.info(`[!] propTypes do not match props`, `[propTypes]`, Object.keys(propTypes), `[props]`, Object.keys(props)) | |
} | |
}; | |
} else { | |
checkProps = (propTypes, props) => {}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment