1 |
|
---|
2 | var tape = require('tape')
|
---|
3 |
|
---|
4 | var indexes = require('./')
|
---|
5 |
|
---|
6 | tape('indexes of - 2 matches', function (t) {
|
---|
7 | var x = indexes([1,2,3, 2,4,5,9,8,0], 2)
|
---|
8 | t.deepEqual(x, [1,3])
|
---|
9 | t.end()
|
---|
10 | })
|
---|
11 |
|
---|
12 |
|
---|
13 | tape('indexes of - 1 match', function (t) {
|
---|
14 | var x = indexes([1,2,3, 2,4,5,9,8,0], 2)
|
---|
15 | t.deepEqual(x, [1,3])
|
---|
16 | t.end()
|
---|
17 | })
|
---|
18 |
|
---|
19 |
|
---|
20 | tape('indexes of - empty', function (t) {
|
---|
21 | var x = indexes([1,2,3, 2,4,5,9,8,0], 24)
|
---|
22 | t.deepEqual(x, [])
|
---|
23 | t.end()
|
---|
24 | })
|
---|
25 |
|
---|
26 |
|
---|
27 | tape('indexes of - empty', function (t) {
|
---|
28 | var x = indexes([8,8,8,8,8,8,8], 8)
|
---|
29 | t.deepEqual(x, [0,1,2,3,4,5,6])
|
---|
30 | t.end()
|
---|
31 | })
|
---|
32 |
|
---|
33 |
|
---|
34 | tape('indexes of - string', function (t) {
|
---|
35 | var x = indexes('foo bar baz foo', 'foo')
|
---|
36 | t.deepEqual(x, [0, 12])
|
---|
37 | t.end()
|
---|
38 | })
|
---|