source: node_modules/ramda-adjunct/es/isPair.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: 746 bytes
Line 
1import { both, equals, length, pipe, curryN } from 'ramda';
2import isArray from './isArray';
3
4/**
5 * Checks if input value is a pair.
6 *
7 * @func isPair
8 * @memberOf RA
9 * @since {@link https://char0n.github.io/ramda-adjunct/1.19.0|v1.19.0}
10 * @category Type
11 * @sig * -> Boolean
12 * @param {*} val The value to test
13 * @return {boolean}
14 * @see {@link http://ramdajs.com/docs/#pair|R.pair}, {@link RA.isNotPair|isNotPair}
15 * @example
16 *
17 * RA.isPair([]); // => false
18 * RA.isPair([0]); // => false
19 * RA.isPair([0, 1]); // => true
20 * RA.isPair([0, 1, 2]); // => false
21 * RA.isPair({ 0: 0, 1: 1 }); // => false
22 * RA.isPair({ foo: 0, bar: 0 }); // => false
23 */
24var isPair = curryN(1, both(isArray, pipe(length, equals(2))));
25export default isPair;
Note: See TracBrowser for help on using the repository browser.