Comparing version 0.1.0 to 0.1.1
@@ -36,3 +36,3 @@ { | ||
"as-it/realign." | ||
"algo/deque." | ||
], | ||
@@ -39,0 +39,0 @@ "console": "integratedTerminal", |
@@ -7,3 +7,3 @@ const AsIt = require('./make'); | ||
active = true; | ||
buf = []; | ||
buf = new $.DQ(); | ||
@@ -110,3 +110,3 @@ clwait() { | ||
} else { | ||
if (stop = await func.call(this, buf, desc)) break; | ||
if (stop = await func.call(this, item, buf.first, desc)) break; | ||
} | ||
@@ -113,0 +113,0 @@ } |
@@ -44,16 +44,16 @@ const AsIt = require('./feed'); | ||
let prefetched; | ||
const getPrefetched = (buf) => { prefetched = buf; } | ||
const getPrefetched = (i, f, {buf}) => { prefetched = buf; } | ||
iter.prefetch(getPrefetched, 2); | ||
expect(await iter.read()).toBe(1); | ||
await $.tick(); | ||
expect(prefetched).toEqual([2, 3]); | ||
expect(Array.from(prefetched)).toEqual([2, 3]); | ||
expect(await iter.read()).toBe(2); | ||
expect(prefetched).toEqual([3, 4]); | ||
expect(Array.from(prefetched)).toEqual([3, 4]); | ||
expect(await iter.affwd(2)).toEqual({done: false, value: 4}); | ||
for (let i = 0; i < 10; i++) await $.tick(); | ||
expect(prefetched).toEqual([5, 6]); | ||
expect(Array.from(prefetched)).toEqual([5, 6]); | ||
expect(await iter.read()).toBe(5); | ||
expect(prefetched).toEqual([6]); | ||
expect(Array.from(prefetched)).toEqual([6]); | ||
expect(await iter.read()).toBe(6); | ||
expect(prefetched).toEqual([]); | ||
expect(Array.from(prefetched)).toEqual([]); | ||
expect(await iter.read()).toBe($.eof); | ||
@@ -86,7 +86,7 @@ }); | ||
let prefetched; | ||
const getPrefetched = (buf) => { prefetched = buf; } | ||
const getPrefetched = (i, f, {buf}) => { prefetched = buf; } | ||
iter.prefetch(getPrefetched, 2); | ||
expect(await iter.read()).toBe(1); | ||
await $.tick(); | ||
expect(prefetched).toEqual([2, 3]); | ||
expect(Array.from(prefetched)).toEqual([2, 3]); | ||
expect(await iter.read()).toBe(2); | ||
@@ -100,7 +100,7 @@ await iter.return(); | ||
let prefetched; | ||
const getPrefetched = (buf) => { prefetched = buf; return buf.length >= 3; } | ||
const getPrefetched = (i, f, {buf}) => { prefetched = buf; return buf.length >= 3; } | ||
iter.prefetch(getPrefetched); | ||
expect(await iter.read()).toBe(1); | ||
await $.tick(); | ||
expect(prefetched).toEqual([2, 3, 4]); | ||
expect(Array.from(prefetched)).toEqual([2, 3, 4]); | ||
expect(await iter.read()).toBe(2); | ||
@@ -107,0 +107,0 @@ expect(await asItArray(iter)).toEqual([3, 4, 5]); |
const it = require('./it'); | ||
const Design = require('./design'); | ||
const Deque = require('./algo/deque'); | ||
const PriorityQueue = require('./algo/priority-queue'); | ||
@@ -84,3 +86,7 @@ const symbol = Symbol('$'); | ||
Object.assign($, {...it, func_, UnknownArgsError, NotImplementedError}); | ||
Object.assign($, it); | ||
Object.assign($, {func_, UnknownArgsError, NotImplementedError}); | ||
$.Deque = $.DQ = Deque; | ||
$.PriorityQueue = $.PQ = PriorityQueue; | ||
module.exports = $; |
@@ -209,3 +209,3 @@ const $ = require('../base'); | ||
if (!Number.isInteger(n) || n <= 0) n = 1; | ||
if (!buf) buf = []; | ||
if (!buf) buf = new $.DQ(); | ||
@@ -212,0 +212,0 @@ return function _lag(v) { |
const $ = require('../base'); | ||
const PriorityQueue = require('../algo/priority-queue'); | ||
@@ -39,4 +38,2 @@ const {func_} = $; | ||
$.PriorityQueue = $.PQ = PriorityQueue; | ||
module.exports = $; |
{ | ||
"name": "asclasit", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "ASync CLasses + ASync ITerators", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
304445
76
8721