From 441ac0e9805b7ec9d178d3cbc5d760b5ff271e90 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Fri, 12 Aug 2022 21:06:59 -0400 Subject: [PATCH] fix(striker-ui): simplify testInput() --- .../lib/test_input/createTestInputFunction.ts | 14 ++++++++++++++ striker-ui/lib/test_input/index.ts | 10 +++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 striker-ui/lib/test_input/createTestInputFunction.ts diff --git a/striker-ui/lib/test_input/createTestInputFunction.ts b/striker-ui/lib/test_input/createTestInputFunction.ts new file mode 100644 index 00000000..2e4da004 --- /dev/null +++ b/striker-ui/lib/test_input/createTestInputFunction.ts @@ -0,0 +1,14 @@ +import testInput from './testInput'; +import { + InputTestBatches, + TestInputFunction, +} from '../../types/TestInputFunction'; + +const createTestInputFunction = + (tests: InputTestBatches) => + ( + ...[options, ...restArgs]: Parameters + ): ReturnType => + testInput({ tests, ...options }, ...restArgs); + +export default createTestInputFunction; diff --git a/striker-ui/lib/test_input/index.ts b/striker-ui/lib/test_input/index.ts index a5241c87..6d9d3c16 100644 --- a/striker-ui/lib/test_input/index.ts +++ b/striker-ui/lib/test_input/index.ts @@ -1,7 +1,15 @@ +import createTestInputFunction from './createTestInputFunction'; import testInput from './testInput'; import testLength from './testLength'; import testMax from './testMax'; import testNotBlank from './testNotBlank'; import testRange from './testRange'; -export { testInput, testLength, testMax, testNotBlank, testRange }; +export { + createTestInputFunction, + testInput, + testLength, + testMax, + testNotBlank, + testRange, +};