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:
714 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { converge, length, uniq } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | import lengthEq from './lengthEq';
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | * Returns true if all items in the list are unique. `R.equals` is used to determine equality.
|
---|
| 7 | *
|
---|
| 8 | * @func allUnique
|
---|
| 9 | * @memberOf RA
|
---|
| 10 | * @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
---|
| 11 | * @category List
|
---|
| 12 | * @sig [a] -> Boolean
|
---|
| 13 | * @param {Array} list The list of values
|
---|
| 14 | * @return {boolean}
|
---|
| 15 | * @see {@link RA.notAllUnique|notAllUnique}, {@link https://ramdajs.com/docs/#equals|equals}
|
---|
| 16 | * @example
|
---|
| 17 | *
|
---|
| 18 | * RA.allUnique([ 1, 2, 3, 4 ]); //=> true
|
---|
| 19 | * RA.allUnique([ 1, 1, 2, 3 ]); //=> false
|
---|
| 20 | * RA.allUnique([]); //=> true
|
---|
| 21 | *
|
---|
| 22 | */
|
---|
| 23 | const allUnique = converge(lengthEq, [length, uniq]);
|
---|
| 24 |
|
---|
| 25 | export default allUnique;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.