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