UNPKG

prray

Version:

'Promisified' Array, comes with async method supports(such as mapAsync). And it is compatible with normal array.

28 lines (24 loc) 676 B
import test from 'ava' import { prray } from '../src/prray' import { toPrrayPromise } from './test-utils' const arr = ['a', 'b', 'c', 'd'] const p = prray(arr) const pp = toPrrayPromise(arr) test('prray values', async t => { const i = p.values() t.is(typeof i.next, 'function') t.is(i.next().value, 'a') t.is(i.next().value, 'b') t.is(i.next().value, 'c') t.is(i.next().value, 'd') t.is(i.next().done, true) }) test('prraypromise values', async t => { const i = await pp.values() t.is(typeof i.next, 'function') t.is(i.next().value, 'a') t.is(i.next().value, 'b') t.is(i.next().value, 'c') t.is(i.next().value, 'd') t.is(i.next().done, true) })