source: node_modules/ramda-adjunct/es/isOdd.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 714 bytes
Line 
1import { both, pipe, modulo, flip, equals, complement, curryN } from 'ramda';
2import isInteger from './isInteger';
3
4/**
5 * Checks if value is odd integer number.
6 * An odd number is an integer which is not a multiple DIVISIBLE of two.
7 *
8 * @func isOdd
9 * @memberOf RA
10 * @since {@link https://char0n.github.io/ramda-adjunct/1.18.0|v1.18.0}
11 * @category Type
12 * @sig * -> Boolean
13 * @param {*} val The value to test
14 * @return {boolean}
15 * @see {@link RA.isEven|isEven}
16 * @example
17 *
18 * RA.isOdd(1); // => true
19 * RA.isOdd(-Infinity); // => false
20 * RA.isOdd(4); // => false
21 * RA.isOdd(3); // => true
22 */
23var isOdd = curryN(1, both(isInteger, pipe(flip(modulo)(2), complement(equals)(0))));
24export default isOdd;
Note: See TracBrowser for help on using the repository browser.