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

jdefer

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jdefer - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

14

index.d.ts

@@ -9,6 +9,3 @@ export interface IDefer<T> {

export default function makeDefer<T = void>(): IDefer<T>;
export declare function makeBroadcastStream<T>(): {
[x: number]: () => AsyncIterator<T>;
export interface IBroadcastStream<T> extends AsyncIterable<T> {
listen(onNext: (value: T) => any, {onError, onDone}?: {

@@ -18,5 +15,12 @@ onError?(error: unknown): any;

}): (this: void) => void;
next(value: T): void;
throw(error: unknown): void;
done(): void;
};
}
export default function makeDefer<T = void>(): IDefer<T>;
export declare function makeBroadcastStream<T>(): IBroadcastStream<T>;

@@ -1,3 +0,1 @@

'use strict'
module.exports = function makeDefer() {

@@ -27,5 +25,7 @@ let resolve = undefined

},
return() {
async return(value) {
return {value: undefined, done: true}
},
throw() {
async throw(e) {
return {value: undefined, done: true}
}

@@ -50,3 +50,6 @@ }

for (const {onNext} of listeners)
onNext(value)
try {
onNext(value)
} catch {
}
},

@@ -59,3 +62,6 @@ throw(error) {

for (const {onError} of listeners)
onError === null || onError === void 0 ? void 0 : onError(error)
try {
onError?.(error)
} catch {
}
},

@@ -66,7 +72,10 @@ done() {

done = true
defer.resolve({done: true})
defer.resolve({value: undefined, done: true})
for (const {onDone} of listeners)
onDone === null || onDone === void 0 ? void 0 : onDone()
try {
onDone?.()
} catch {
}
},
}
}
{
"name": "jdefer",
"version": "0.0.11",
"version": "0.0.12",
"main": "index.js",

@@ -5,0 +5,0 @@ "repository": "https://github.com/tranvansang/jdefer",

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