-
Notifications
You must be signed in to change notification settings - Fork 87
/
uniqWith.js
39 lines (34 loc) · 821 Bytes
/
uniqWith.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const R = require('../../dist/rambda.js')
const Ramda = require('ramda')
const {
uniqListOfStrings,
uniqListOfBooleans,
uniqListOfNumbers,
uniqListOfLists,
uniqListOfObjects,
} = require('./_utils.js')
const limit = 100
const modes = [
[uniqListOfStrings(limit), (x, y) => x.length === y.length],
[uniqListOfBooleans(limit), (x, y) => x === y],
[uniqListOfNumbers(limit), (x, y) => x > y],
[uniqListOfLists(limit), (x, y) => x.length === y.length],
[
uniqListOfObjects(limit),
x => (x, y) => Object.keys(x).length === Object.keys(y).length,
],
]
function applyBenchmark(fn, input) {
return fn(input[1], input[0])
}
const tests = [
{
label: 'Rambda',
fn: R.uniqWith,
},
{
label: 'Ramda',
fn: Ramda.uniqWith,
},
]
module.exports = {modes, tests, applyBenchmark}