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:
809 bytes
|
Line | |
---|
1 | import { pipe, uniq, curryN } from 'ramda';
|
---|
2 |
|
---|
3 | import lengthLte from './lengthLte';
|
---|
4 |
|
---|
5 | // Original idea for this function was conceived by https://github.com/jackmellis
|
---|
6 | // in https://github.com/char0n/ramda-adjunct/pull/513.
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * Returns true if all items in the list are equivalent using `R.equals` for equality comparisons.
|
---|
10 | *
|
---|
11 | * @func allEqual
|
---|
12 | * @memberOf RA
|
---|
13 | * @since {@link https://char0n.github.io/ramda-adjunct/2.9.0|v2.9.0}
|
---|
14 | * @category List
|
---|
15 | * @sig [a] -> Boolean
|
---|
16 | * @param {Array} list The list of values
|
---|
17 | * @return {boolean}
|
---|
18 | * @see {@link https://ramdajs.com/docs/#equals|equals}
|
---|
19 | * @example
|
---|
20 | *
|
---|
21 | * RA.allEqual([ 1, 2, 3, 4 ]); //=> false
|
---|
22 | * RA.allEqual([ 1, 1, 1, 1 ]); //=> true
|
---|
23 | * RA.allEqual([]); //=> true
|
---|
24 | *
|
---|
25 | */
|
---|
26 | const allEqual = curryN(1, pipe(uniq, lengthLte(1)));
|
---|
27 |
|
---|
28 | export default allEqual;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.