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