@strictly/define 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.out/index.d.ts +2 -0
- package/.out/index.js +2 -0
- package/.out/transformers/flatteners/flatten_type_to.d.ts +1 -1
- package/.out/transformers/flatteners/flatten_type_to.js +1 -1
- package/.out/tsconfig.tsbuildinfo +1 -1
- package/.out/types/builders.d.ts +1 -2
- package/.out/types/builders.js +3 -7
- package/.out/validation/validator.d.ts +9 -7
- package/.out/validation/validator.js +6 -0
- package/.out/validation/validators/minimum_string_length_validator.js +1 -1
- package/.out/validation/validators/optional_validator_proxy.d.ts +13 -0
- package/.out/validation/validators/optional_validator_proxy.js +26 -0
- package/.out/validation/validators/regexp_validator.d.ts +29 -0
- package/.out/validation/validators/regexp_validator.js +37 -0
- package/.out/validation/validators/specs/minimum_string_length_validator.tests.d.ts +1 -0
- package/.out/validation/validators/specs/minimum_string_length_validator.tests.js +69 -0
- package/.out/validation/validators/specs/regexp_validator.tests.d.ts +1 -0
- package/.out/validation/validators/specs/regexp_validator.tests.js +98 -0
- package/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-check-types.log +1 -1
- package/.turbo/turbo-release$colon$exports.log +1 -1
- package/dist/index.cjs +87 -8
- package/dist/index.d.cts +53 -10
- package/dist/index.d.ts +53 -10
- package/dist/index.js +83 -8
- package/index.ts +2 -0
- package/package.json +1 -1
- package/transformers/flatteners/flatten_type_to.ts +2 -2
- package/types/builders.ts +4 -13
- package/validation/validator.ts +13 -4
- package/validation/validators/minimum_string_length_validator.ts +1 -1
- package/validation/validators/optional_validator_proxy.ts +52 -0
- package/validation/validators/regexp_validator.ts +61 -0
- package/validation/validators/specs/minimum_string_length_validator.tests.ts +76 -0
- package/validation/validators/specs/regexp_validator.tests.ts +108 -0
package/.out/index.d.ts
CHANGED
|
@@ -23,4 +23,6 @@ export * from './types/value_types_of_discriminated_union';
|
|
|
23
23
|
export * from './validation/validator';
|
|
24
24
|
export * from './validation/validators/defined_validator';
|
|
25
25
|
export * from './validation/validators/minimum_string_length_validator';
|
|
26
|
+
export * from './validation/validators/optional_validator_proxy';
|
|
27
|
+
export * from './validation/validators/regexp_validator';
|
|
26
28
|
export * from './validation/validators_of_values';
|
package/.out/index.js
CHANGED
|
@@ -23,4 +23,6 @@ export * from './types/value_types_of_discriminated_union';
|
|
|
23
23
|
export * from './validation/validator';
|
|
24
24
|
export * from './validation/validators/defined_validator';
|
|
25
25
|
export * from './validation/validators/minimum_string_length_validator';
|
|
26
|
+
export * from './validation/validators/optional_validator_proxy';
|
|
27
|
+
export * from './validation/validators/regexp_validator';
|
|
26
28
|
export * from './validation/validators_of_values';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type StrictType, type StrictTypeDef } from 'types/strict_definitions';
|
|
2
2
|
export type AnyValueType = any;
|
|
3
|
-
export type Mapper<R> = (t: StrictTypeDef) => R;
|
|
3
|
+
export type Mapper<R> = (t: StrictTypeDef, key: string) => R;
|
|
4
4
|
export declare function flattenTypeTo<M, R extends Readonly<Record<string, M>>>({ definition }: StrictType, mapper: Mapper<M>): R;
|
|
@@ -5,7 +5,7 @@ export function flattenTypeTo({ definition }, mapper) {
|
|
|
5
5
|
const typeDefs = internalFlattenTypeDef('$', definition, {});
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
7
7
|
return reduce(typeDefs, function (acc, key, typeDef) {
|
|
8
|
-
acc[key] = mapper(typeDef);
|
|
8
|
+
acc[key] = mapper(typeDef, key);
|
|
9
9
|
return acc;
|
|
10
10
|
},
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|