Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 9x 3x 9x 17x | import { Predicate } from "@benneq/predicate";
/**
* Creates a {@link Predicate} that checks if a number is divisible by
* a given `divider`.
*
* @example
* ```ts
* const isDivisibleBy3 = isDivisibleBy(3);
*
* const result = isDivisibleBy3(-6);
*
* console.log(result); // true
* ```
*
* @param divider - the divider to use
* @returns the {@link Predicate}
*/
export const isDivisibleBy =
(divider: number): Predicate<[number]> =>
(num) => {
return !(num % divider);
};
|