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