(options: {
readonly isInteger?: boolean | undefined
readonly min?: unknown
readonly minExcluded?: boolean | undefined
readonly max?: unknown
readonly maxExcluded?: boolean | undefined
readonly noNaN?: boolean | undefined
readonly noDefaultInfinity?: boolean | undefined
})
| 98 | |
| 99 | /** @internal */ |
| 100 | export const makeNumberConstraints = (options: { |
| 101 | readonly isInteger?: boolean | undefined |
| 102 | readonly min?: unknown |
| 103 | readonly minExcluded?: boolean | undefined |
| 104 | readonly max?: unknown |
| 105 | readonly maxExcluded?: boolean | undefined |
| 106 | readonly noNaN?: boolean | undefined |
| 107 | readonly noDefaultInfinity?: boolean | undefined |
| 108 | }): NumberConstraints => { |
| 109 | const out: Types.Mutable<NumberConstraints> = { |
| 110 | _tag: "NumberConstraints", |
| 111 | constraints: {}, |
| 112 | isInteger: options.isInteger ?? false |
| 113 | } |
| 114 | if (Predicate.isNumber(options.min)) { |
| 115 | out.constraints.min = Math.fround(options.min) |
| 116 | } |
| 117 | if (Predicate.isBoolean(options.minExcluded)) { |
| 118 | out.constraints.minExcluded = options.minExcluded |
| 119 | } |
| 120 | if (Predicate.isNumber(options.max)) { |
| 121 | out.constraints.max = Math.fround(options.max) |
| 122 | } |
| 123 | if (Predicate.isBoolean(options.maxExcluded)) { |
| 124 | out.constraints.maxExcluded = options.maxExcluded |
| 125 | } |
| 126 | if (Predicate.isBoolean(options.noNaN)) { |
| 127 | out.constraints.noNaN = options.noNaN |
| 128 | } |
| 129 | if (Predicate.isBoolean(options.noDefaultInfinity)) { |
| 130 | out.constraints.noDefaultInfinity = options.noDefaultInfinity |
| 131 | } |
| 132 | return out |
| 133 | } |
| 134 | |
| 135 | interface BigIntConstraints { |
| 136 | readonly _tag: "BigIntConstraints" |
no outgoing calls
no test coverage detected