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

@wixc3/create-disposables

Package Overview
Dependencies
Maintainers
78
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wixc3/create-disposables - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

9

dist/create-disposables.d.ts
export declare function createDisposables(): {
dispose(): Promise<void>;
add<T extends {
dispose(): unknown;
} | (() => unknown)>(disposable: T): T;
add(disposable: Disposable): void;
};
export declare type DisposeFunction = () => unknown;
export declare type Disposable = {
dispose: DisposeFunction;
} | DisposeFunction;
export declare type Disposables = ReturnType<typeof createDisposables>;
//# sourceMappingURL=create-disposables.d.ts.map

@@ -8,3 +8,3 @@ "use strict";

async dispose() {
const toDispose = new Set(Array.from(disposables).reverse());
const toDispose = Array.from(disposables).reverse();
disposables.clear();

@@ -22,3 +22,2 @@ for (const dispose of toDispose) {

}
return disposable;
},

@@ -25,0 +24,0 @@ };

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

{
"name": "@wixc3/create-disposables",
"version": "1.1.1",
"version": "2.0.0",
"description": "A utility for saving objects to be disposed",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -6,3 +6,3 @@ export function createDisposables() {

async dispose() {
const toDispose = new Set(Array.from(disposables).reverse());
const toDispose = Array.from(disposables).reverse();
disposables.clear();

@@ -13,3 +13,3 @@ for (const dispose of toDispose) {

},
add<T extends { dispose(): unknown } | (() => unknown)>(disposable: T): T {
add(disposable: Disposable) {
if (typeof disposable === 'function') {

@@ -20,5 +20,8 @@ disposables.add(disposable);

}
return disposable;
},
};
}
export type DisposeFunction = () => unknown;
export type Disposable = { dispose: DisposeFunction } | DisposeFunction;
export type Disposables = ReturnType<typeof createDisposables>;

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