Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

it-pushable

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

it-pushable - npm Package Compare versions

Comparing version 3.1.2 to 3.1.3

6

dist/src/fifo.d.ts

@@ -1,2 +0,6 @@

import type { Next } from './index.js';
export interface Next<T> {
done?: boolean;
error?: Error;
value?: T;
}
export interface FIFOOptions {

@@ -3,0 +7,0 @@ /**

16

dist/src/index.d.ts

@@ -49,7 +49,2 @@ /**

*/
export interface Next<T> {
done?: boolean;
error?: Error;
value?: T;
}
interface BasePushable<T> {

@@ -67,9 +62,2 @@ /**

push: (value: T) => this;
next: () => Promise<Next<T>>;
return: () => {
done: boolean;
};
throw: (err: Error) => {
done: boolean;
};
/**

@@ -86,3 +74,3 @@ * This property contains the number of bytes (or objects) in the queue ready to be read.

*/
export interface Pushable<T> extends AsyncIterable<T>, BasePushable<T> {
export interface Pushable<T, R = void, N = unknown> extends AsyncGenerator<T, R, N>, BasePushable<T> {
}

@@ -92,3 +80,3 @@ /**

*/
export interface PushableV<T> extends AsyncIterable<T[]>, BasePushable<T> {
export interface PushableV<T, R = void, N = unknown> extends AsyncGenerator<T[], R, N>, BasePushable<T> {
}

@@ -95,0 +83,0 @@ export interface Options {

{
"BasePushable": "https://alanshaw.github.io/it-pushable/interfaces/_internal_.BasePushable.html",
"BytePushableOptions": "https://alanshaw.github.io/it-pushable/interfaces/BytePushableOptions.html",
"Next": "https://alanshaw.github.io/it-pushable/interfaces/Next.html",
"ObjectPushableOptions": "https://alanshaw.github.io/it-pushable/interfaces/ObjectPushableOptions.html",

@@ -5,0 +5,0 @@ "Options": "https://alanshaw.github.io/it-pushable/interfaces/Options.html",

{
"name": "it-pushable",
"version": "3.1.2",
"version": "3.1.3",
"description": "An iterable that you can push values into",

@@ -147,7 +147,7 @@ "author": "Alan Shaw",

"@types/fast-fifo": "^1.0.0",
"aegir": "^37.7.8",
"it-all": "^2.0.0",
"it-pipe": "^2.0.0",
"aegir": "^38.1.8",
"it-all": "^3.0.1",
"it-pipe": "^3.0.1",
"uint8arraylist": "^2.0.0"
}
}
// ported from https://www.npmjs.com/package/fast-fifo
import type { Next } from './index.js'
export interface Next<T> {
done?: boolean
error?: Error
value?: T
}

@@ -24,3 +28,3 @@ class FixedFIFO<T> {

push (data: Next<T>) {
push (data: Next<T>): boolean {
if (this.buffer[this.top] !== undefined) {

@@ -36,3 +40,3 @@ return false

shift () {
shift (): Next<T> | undefined {
const last = this.buffer[this.btm]

@@ -49,3 +53,3 @@

isEmpty () {
isEmpty (): boolean {
return this.buffer[this.btm] === undefined

@@ -83,3 +87,3 @@ }

push (val: Next<T>) {
push (val: Next<T>): void {
if (val?.value != null) {

@@ -96,3 +100,3 @@ this.size += this.calculateSize(val.value)

shift () {
shift (): Next<T> | undefined {
let val = this.tail.shift()

@@ -114,5 +118,5 @@

isEmpty () {
isEmpty (): boolean {
return this.head.isEmpty()
}
}

@@ -50,10 +50,4 @@ /**

import { FIFO } from './fifo.js'
import { FIFO, Next } from './fifo.js'
export interface Next<T> {
done?: boolean
error?: Error
value?: T
}
interface BasePushable<T> {

@@ -72,5 +66,2 @@ /**

push: (value: T) => this
next: () => Promise<Next<T>>
return: () => { done: boolean }
throw: (err: Error) => { done: boolean }

@@ -89,3 +80,3 @@ /**

*/
export interface Pushable<T> extends AsyncIterable<T>, BasePushable<T> {}
export interface Pushable<T, R = void, N = unknown> extends AsyncGenerator<T, R, N>, BasePushable<T> {}

@@ -95,3 +86,3 @@ /**

*/
export interface PushableV<T> extends AsyncIterable<T[]>, BasePushable<T> {}
export interface PushableV<T, R = void, N = unknown> extends AsyncGenerator<T[], R, N>, BasePushable<T> {}

@@ -112,3 +103,3 @@ export interface Options {

type NextResult<T> = { done: false, value: T} | { done: true }
type NextResult<T> = { done: false, value: T } | { done: true }

@@ -224,3 +215,3 @@ interface getNext<T, V = T> { (buffer: FIFO<T>): NextResult<V> }

const bufferNext = (next: Next<PushType>) => {
const bufferNext = (next: Next<PushType>): ReturnType => {
if (onNext != null) {

@@ -234,3 +225,3 @@ return onNext(next)

const bufferError = (err: Error) => {
const bufferError = (err: Error): ReturnType => {
buffer = new FIFO()

@@ -246,3 +237,3 @@

const push = (value: PushType) => {
const push = (value: PushType): ReturnType => {
if (ended) {

@@ -259,3 +250,3 @@ return pushable

}
const end = (err?: Error) => {
const end = (err?: Error): ReturnType => {
if (ended) return pushable

@@ -266,3 +257,3 @@ ended = true

}
const _return = () => {
const _return = (): NextResult<ValueType> => {
buffer = new FIFO()

@@ -273,3 +264,3 @@ end()

}
const _throw = (err: Error) => {
const _throw = (err: Error): NextResult<ValueType> => {
end(err)

@@ -276,0 +267,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc