source: node_modules/ramda-adjunct/src/isSentinelValue.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: 814 bytes
Line 
1import { curryN } from 'ramda';
2
3import isInteger32 from './isInteger32';
4
5/**
6 * Checks whether the passed value is {@link https://github.com/getify/You-Dont-Know-JS/blob/9959fc904d584bbf0b02cf41c192f74ff4238581/types-grammar/ch4.md#the-curious-case-of-the-|a sentinel value}.
7 *
8 * @func isSentinelValue
9 * @memberOf RA
10 * @since {@link https://char0n.github.io/ramda-adjunct/2.33.0|v2.33.0}
11 * @category Type
12 * @sig * -> Boolean
13 * @param {*} val The value to test
14 * @return {boolean}
15 * @example
16 *
17 * RA.isSentinelValue(-1); //=> true
18 *
19 * RA.isSentinelValue('-1'); //=> false
20 * RA.isSentinelValue(1); //=> false
21 * RA.isSentinelValue([-1]); //=> false
22 */
23// eslint-disable-next-line no-bitwise
24const isSentinelValue = curryN(1, (val) => isInteger32(val) && ~val === 0);
25
26export default isSentinelValue;
Note: See TracBrowser for help on using the repository browser.