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