react-moment-proptypes-browser-build
Advanced tools
Comparing version 0.1.1 to 0.6.0
@@ -90,6 +90,2 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
moment.createFromInputFallback = function(config) { | ||
config._d = new Date(config._i); | ||
}; | ||
module.exports = { | ||
@@ -200,2 +196,23 @@ | ||
var independentGuardianValue = -1; | ||
function preValidationRequireCheck(isRequired, componentName, propFullName, propValue) { | ||
var isPropValueUndefined = typeof propValue === 'undefined'; | ||
var isPropValueNull = propValue === null; | ||
if (isRequired) { | ||
if (isPropValueUndefined) { | ||
return createInvalidRequiredErrorMessage(propFullName, componentName, 'undefined'); | ||
} else if (isPropValueNull) { | ||
return createInvalidRequiredErrorMessage(propFullName, componentName, 'null'); | ||
} | ||
} | ||
if (isPropValueUndefined || isPropValueNull) { | ||
return null; | ||
} | ||
return independentGuardianValue; | ||
} | ||
function createMomentChecker(type, typeValidator, validator, momentType) { | ||
@@ -215,17 +232,11 @@ | ||
var isPropValueUndefined = typeof propValue === 'undefined'; | ||
var isPropValueNull = propValue === null; | ||
componentName = componentName || messages.anonymousMessage; | ||
propFullName = propFullName || propName; | ||
if (isRequired) { | ||
componentName = componentName || messages.anonymousMessage; | ||
propFullName = propFullName || propName; | ||
if (isPropValueUndefined) { | ||
return createInvalidRequiredErrorMessage(propFullName, componentName, 'undefined'); | ||
} else if (isPropValueNull) { | ||
return createInvalidRequiredErrorMessage(propFullName, componentName, 'null'); | ||
} | ||
} | ||
var preValidationRequireCheckValue = preValidationRequireCheck( | ||
isRequired, componentName, propFullName, propValue | ||
); | ||
if (isPropValueUndefined || isPropValueNull) { | ||
return null; | ||
if (preValidationRequireCheckValue !== independentGuardianValue) { | ||
return preValidationRequireCheckValue; | ||
} | ||
@@ -240,3 +251,3 @@ | ||
if (! validator(propValue)) { | ||
if (!validator(propValue)) { | ||
return new Error( | ||
@@ -248,3 +259,3 @@ messages.baseInvalidMessage + location + ' `' + propName + '` of type `' + propType + '` ' + | ||
if (predicate && ! predicate(propValue)) { | ||
if (predicate && !predicate(propValue)) { | ||
var predicateName = predicate.name || messages.anonymousMessage; | ||
@@ -251,0 +262,0 @@ return new Error( |
{ | ||
"name": "react-moment-proptypes-browser-build", | ||
"version": "0.1.1", | ||
"version": "0.6.0", | ||
"description": "Direct browser importable version of react-moment-proptypes", | ||
@@ -13,3 +13,3 @@ "main": "lib/react-moment-proptypes.js", | ||
"dependencies": { | ||
"react-moment-proptypes": "^1.5.0" | ||
"react-moment-proptypes": "^1.6.0" | ||
}, | ||
@@ -16,0 +16,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
22613
275