(options: {
readonly minLength?: number | undefined
readonly maxLength?: number | undefined
readonly pattern?: string | undefined
})
| 70 | |
| 71 | /** @internal */ |
| 72 | export const makeStringConstraints = (options: { |
| 73 | readonly minLength?: number | undefined |
| 74 | readonly maxLength?: number | undefined |
| 75 | readonly pattern?: string | undefined |
| 76 | }): StringConstraints => { |
| 77 | const out: Types.Mutable<StringConstraints> = { |
| 78 | _tag: "StringConstraints", |
| 79 | constraints: {} |
| 80 | } |
| 81 | if (Predicate.isNumber(options.minLength)) { |
| 82 | out.constraints.minLength = options.minLength |
| 83 | } |
| 84 | if (Predicate.isNumber(options.maxLength)) { |
| 85 | out.constraints.maxLength = options.maxLength |
| 86 | } |
| 87 | if (Predicate.isString(options.pattern)) { |
| 88 | out.pattern = options.pattern |
| 89 | } |
| 90 | return out |
| 91 | } |
| 92 | |
| 93 | interface NumberConstraints { |
| 94 | readonly _tag: "NumberConstraints" |
no outgoing calls
no test coverage detected
searching dependent graphs…