better-prop-types
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -0,1 +1,8 @@ | ||
## [1.1.1](https://github.com/ivangabriele/better-prop-types/compare/v1.1.0...v1.1.1) (2022-01-25) | ||
### Bug Fixes | ||
* replace chainable type binding with factory ([47bfd65](https://github.com/ivangabriele/better-prop-types/commit/47bfd65f0e8a1e64f30143d28605b73f89fb2a12)) | ||
# [1.1.0](https://github.com/ivangabriele/better-prop-types/compare/v1.0.0...v1.1.0) (2022-01-25) | ||
@@ -2,0 +9,0 @@ |
import PropTypes from 'prop-types'; | ||
function createBetterChainableTypeChecker(validate) { | ||
function checkType(is, props, propName, componentName, location, propFullName, ...rest) { | ||
const makeCheckType = (is) => (props, propName, componentName, location, propFullName, ...rest) => { | ||
const finalPropFullName = propFullName !== null ? propFullName : propName; | ||
@@ -33,7 +33,7 @@ const propValue = props[propName]; | ||
} | ||
} | ||
const chainedCheckType = Object.assign(checkType.bind(null, undefined), { | ||
isOptionalButNotNull: checkType.bind(null, 'UNNULLABLE'), | ||
isRequired: checkType.bind(null, 'REQUIRED'), | ||
isRequiredButNullable: checkType.bind(null, 'NULLABLE'), | ||
}; | ||
const chainedCheckType = Object.assign(makeCheckType(), { | ||
isOptionalButNotNull: makeCheckType('UNNULLABLE'), | ||
isRequired: makeCheckType('REQUIRED'), | ||
isRequiredButNullable: makeCheckType('NULLABLE'), | ||
}); | ||
@@ -40,0 +40,0 @@ return chainedCheckType; |
{ | ||
"name": "better-prop-types", | ||
"description": "Better PropTypes.", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27726