UNPKG

553 BJavaScriptView Raw
1import ReactPropTypesSecret from 'prop-types/lib/ReactPropTypesSecret'
2
3export default function checkArgs(typeSpecs, values, location, componentName) {
4 if (process.env.NODE_ENV !== 'production') {
5 for (var typeSpecName in typeSpecs) {
6 if (typeSpecs.hasOwnProperty(typeSpecName)) {
7 const error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret)
8 if (error instanceof Error) {
9 throw new Error(`Failed ${location} type: ${error.message}`)
10 }
11 }
12 }
13 }
14}