Socket
Socket
Sign inDemoInstall

@wixc3/patterns

Package Overview
Dependencies
Maintainers
68
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wixc3/patterns - npm Package Compare versions

Comparing version 9.1.0 to 9.2.0

6

dist/cjs/disposables/disposal-groups.d.ts

@@ -62,4 +62,8 @@ import { GroupConstraints } from './constraints';

registerGroup: (name: string, _constraints: GroupConstraints[] | GroupConstraints) => void;
add: (disposable: Disposable, options?: DisposableOptions) => void;
/**
* @param disposable a function or object with a dispose method
* @param options if string, will be used as group name
*/
add: (disposable: Disposable, options?: DisposableOptions | string) => void;
/**
* removes a disposable from all disposal group

@@ -66,0 +70,0 @@ */

@@ -74,3 +74,10 @@ "use strict";

},
/**
* @param disposable a function or object with a dispose method
* @param options if string, will be used as group name
*/
add: (disposable, options) => {
if (typeof options === 'string') {
options = { group: options };
}
const { group: groupName, name, timeout } = withDefaults(options);

@@ -77,0 +84,0 @@ const group = groups.find((g) => g.name === groupName);

@@ -62,4 +62,8 @@ import { GroupConstraints } from './constraints';

registerGroup: (name: string, _constraints: GroupConstraints[] | GroupConstraints) => void;
add: (disposable: Disposable, options?: DisposableOptions) => void;
/**
* @param disposable a function or object with a dispose method
* @param options if string, will be used as group name
*/
add: (disposable: Disposable, options?: DisposableOptions | string) => void;
/**
* removes a disposable from all disposal group

@@ -66,0 +70,0 @@ */

@@ -71,3 +71,10 @@ import { getValidatedConstantsGroups, normalizeConstraints } from './constraints';

},
/**
* @param disposable a function or object with a dispose method
* @param options if string, will be used as group name
*/
add: (disposable, options) => {
if (typeof options === 'string') {
options = { group: options };
}
const { group: groupName, name, timeout } = withDefaults(options);

@@ -74,0 +81,0 @@ const group = groups.find((g) => g.name === groupName);

2

package.json
{
"name": "@wixc3/patterns",
"version": "9.1.0",
"version": "9.2.0",
"description": "A utility for saving objects to be disposed",

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

@@ -93,3 +93,10 @@ import { DisposalGroup, getValidatedConstantsGroups, GroupConstraints, normalizeConstraints } from './constraints';

add: (disposable: Disposable, options?: DisposableOptions) => {
/**
* @param disposable a function or object with a dispose method
* @param options if string, will be used as group name
*/
add: (disposable: Disposable, options?: DisposableOptions | string) => {
if (typeof options === 'string') {
options = { group: options };
}
const { group: groupName, name, timeout } = withDefaults(options);

@@ -96,0 +103,0 @@ const group = groups.find((g) => g.name === groupName);

@@ -74,2 +74,10 @@ import { expect, use } from 'chai';

});
describe('add', () => {
describe('with a string as options', () => {
const groups = createDisposables();
groups.registerGroup('first', { before: 'default' });
groups.add(() => void 0, 'first');
expect(groups.list().groups[0]?.disposables).to.have.length(1);
});
});
describe('list', () => {

@@ -76,0 +84,0 @@ it('returns the list of groups', () => {

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

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