source: node_modules/ramda-adjunct/es/isSentinelValue.js@ d24f17c

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

Initial commit

  • Property mode set to 100644
File size: 829 bytes
Line 
1import { curryN } from 'ramda';
2import isInteger32 from './isInteger32';
3
4/**
5 * 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}.
6 *
7 * @func isSentinelValue
8 * @memberOf RA
9 * @since {@link https://char0n.github.io/ramda-adjunct/2.33.0|v2.33.0}
10 * @category Type
11 * @sig * -> Boolean
12 * @param {*} val The value to test
13 * @return {boolean}
14 * @example
15 *
16 * RA.isSentinelValue(-1); //=> true
17 *
18 * RA.isSentinelValue('-1'); //=> false
19 * RA.isSentinelValue(1); //=> false
20 * RA.isSentinelValue([-1]); //=> false
21 */
22// eslint-disable-next-line no-bitwise
23var isSentinelValue = curryN(1, function (val) {
24 return isInteger32(val) && ~val === 0;
25});
26export default isSentinelValue;
Note: See TracBrowser for help on using the repository browser.