Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit d5a1190

Browse files
author
Kent C. Dodds
committed
refactor(api-check): Remove nullable logic
Nullable is available in api-check 7.0.0 which we've supported for a while now...
1 parent 4813d63 commit d5a1190

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/providers/formlyApiCheck.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,8 @@ function shapeRequiredIfNot(otherProps, propChecker) {
3030
return apiCheck.utils.checkerHelpers.setupChecker(shapeRequiredIfNotDefinition);
3131
}
3232

33-
// TODO in 7.0.0 .nullable is available on all checkers
34-
function nullable(checker) {
35-
return apiCheck.oneOfType([
36-
apiCheck.oneOf([null]), checker
37-
]);
38-
}
39-
4033
const formlyExpression = apiCheck.oneOfType([apiCheck.string, apiCheck.func]);
41-
const specifyWrapperType = nullable(apiCheck.typeOrArrayOf(apiCheck.string));
34+
const specifyWrapperType = apiCheck.typeOrArrayOf(apiCheck.string).nullable;
4235

4336
const apiCheckProperty = apiCheck.oneOfType([apiCheck.func, apiCheck.objectOf(apiCheck.func)]);
4437

@@ -73,10 +66,10 @@ const expressionProperties = apiCheck.objectOf(apiCheck.oneOfType([
7366

7467
const modelChecker = apiCheck.oneOfType([apiCheck.string, apiCheck.object]);
7568

76-
const templateManipulators = nullable(apiCheck.shape({
77-
preWrapper: nullable(apiCheck.arrayOf(apiCheck.func)).optional,
78-
postWrapper: nullable(apiCheck.arrayOf(apiCheck.func)).optional
79-
}).strict);
69+
const templateManipulators = apiCheck.shape({
70+
preWrapper: apiCheck.arrayOf(apiCheck.func).nullable.optional,
71+
postWrapper: apiCheck.arrayOf(apiCheck.func).nullable.optional
72+
}).strict.nullable;
8073

8174
const validatorChecker = apiCheck.objectOf(apiCheck.oneOfType([
8275
formlyExpression, apiCheck.shape({
@@ -149,7 +142,7 @@ const fieldOptionsApiShape = {
149142
apiCheck.string, apiCheck.func, apiCheck.array
150143
]).optional,
151144
validation: apiCheck.shape({
152-
show: nullable(apiCheck.bool).optional,
145+
show: apiCheck.bool.nullable.optional,
153146
messages: apiCheck.objectOf(formlyExpression).optional,
154147
errorExistsAndShouldBeVisible: apiCheck.bool.optional
155148
}).optional,

0 commit comments

Comments
 (0)