Files: 53993d4b470f0742ad15adb19ec03653e415da6a / test / unique.js
618 bytesRaw
1 | |
2 | var pull = require('../') |
3 | var test = require('tape') |
4 | |
5 | test('unique', function (t) { |
6 | var numbers = [1, 2, 2, 3, 4, 5, 6, 4, 0, 6, 7, 8, 3, 1, 2, 9, 0] |
7 | |
8 | pull( |
9 | pull.values(numbers), |
10 | pull.unique(), |
11 | pull.collect(function (err, ary) { |
12 | t.deepEqual(ary.sort(), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) |
13 | t.end() |
14 | }) |
15 | ) |
16 | }) |
17 | |
18 | test('non-unique', function (t) { |
19 | var numbers = [1, 2, 2, 3, 4, 5, 6, 4, 0, 6, 7, 8, 3, 1, 2, 9, 0] |
20 | |
21 | pull( |
22 | pull.values(numbers), |
23 | pull.nonUnique(), |
24 | pull.collect(function (err, ary) { |
25 | t.deepEqual(ary.sort(), [0, 1, 2, 2, 3, 4, 6]) |
26 | t.end() |
27 | }) |
28 | ) |
29 | |
30 | |
31 | }) |
32 |
Built with git-ssb-web