git ssb

3+

cel / ssb-npm-registry



Tree: 4f27567900a7b5b821bccc74e95bfc96c8233159

Files: 4f27567900a7b5b821bccc74e95bfc96c8233159 / node_modules / pull-stream / 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