Fix PropType for travis

closes #1404
This commit is contained in:
Cheng Lou
2014-04-14 17:20:50 -07:00
committed by Paul O’Shannessy
parent 717eacdb64
commit c6df1c2dd2
+8 -2
View File
@@ -281,12 +281,18 @@ function isRenderable(propValue) {
}
}
// Equivalent of `typeof` but with special handling for array.
// Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) {
var propType = typeof propValue;
if (Array.isArray(propValue)) {
return 'array';
}
if (propValue instanceof RegExp) {
// Old webkits (at least until Android 4.0) return 'function' rather than
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
// passes PropTypes.object.
return 'object';
}
return propType;
}
@@ -297,7 +303,7 @@ function getPreciseType(propValue) {
if (propType === 'object') {
if (propValue instanceof Date) {
return 'date';
} else if(propValue instanceof RegExp) {
} else if (propValue instanceof RegExp) {
return 'regexp';
}
}