ramda-adjunct
Version:
Ramda Adjunct is the most popular and most comprehensive set of utilities for use with Ramda, providing a variety of useful, well tested functions with excellent documentation.
26 lines (25 loc) • 832 B
JavaScript
import { curryN } from 'ramda';
import isInteger32 from './isInteger32.js';
/**
* 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}.
*
* @func isSentinelValue
* @memberOf RA
* @since {@link https://char0n.github.io/ramda-adjunct/2.33.0|v2.33.0}
* @category Type
* @sig * -> Boolean
* @param {*} val The value to test
* @return {boolean}
* @example
*
* RA.isSentinelValue(-1); //=> true
*
* RA.isSentinelValue('-1'); //=> false
* RA.isSentinelValue(1); //=> false
* RA.isSentinelValue([-1]); //=> false
*/
// eslint-disable-next-line no-bitwise
var isSentinelValue = curryN(1, function (val) {
return isInteger32(val) && ~val === 0;
});
export default isSentinelValue;