(options: {
readonly remainder: (input: T, divisor: T) => T
readonly zero: NoInfer<T>
readonly annotate?: ((divisor: T) => Annotations.Filter) | undefined
readonly formatter?: Formatter<T> | undefined
})
| 7848 | * @since 4.0.0 |
| 7849 | */ |
| 7850 | export function makeIsMultipleOf<T>(options: { |
| 7851 | readonly remainder: (input: T, divisor: T) => T |
| 7852 | readonly zero: NoInfer<T> |
| 7853 | readonly annotate?: ((divisor: T) => Annotations.Filter) | undefined |
| 7854 | readonly formatter?: Formatter<T> | undefined |
| 7855 | }) { |
| 7856 | return (divisor: T, annotations?: Annotations.Filter) => { |
| 7857 | const formatter = options.formatter ?? format |
| 7858 | return makeFilter<T>( |
| 7859 | (input) => options.remainder(input, divisor) === options.zero, |
| 7860 | { |
| 7861 | expected: `a value that is a multiple of ${formatter(divisor)}`, |
| 7862 | ...options.annotate?.(divisor), |
| 7863 | ...annotations |
| 7864 | } |
| 7865 | ) |
| 7866 | } |
| 7867 | } |
| 7868 | |
| 7869 | function encodeNumberPayload(number: number): number { |
| 7870 | if (!globalThis.Number.isFinite(number)) { |
no test coverage detected