git ssb

2+

Dominic / pull-stream



Tree: 22c80b9c74339096c81f7668440f2b298fad8116

Files: 22c80b9c74339096c81f7668440f2b298fad8116 / test / unique.js

618 bytesRaw
1
2var pull = require('../')
3var test = require('tape')
4
5test('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
18test('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