You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@a-type/utils

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@a-type/utils - npm Package Compare versions

Comparing version

to
1.0.2

1

dist/cjs/index.d.ts
export declare function assert(condition: any, message?: string): asserts condition;
export declare function debounce<Fn extends (...args: any[]) => void>(callback: Fn, delay: number): Fn;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.assert = void 0;
exports.debounce = exports.assert = void 0;
function assert(condition, message = 'assertion failed') {

@@ -10,2 +10,15 @@ if (!condition) {

exports.assert = assert;
function debounce(callback, delay) {
let timeout;
return ((...args) => {
if (timeout !== undefined) {
clearTimeout(timeout);
}
timeout = setTimeout(() => {
timeout = undefined;
callback(...args);
}, delay);
});
}
exports.debounce = debounce;
//# sourceMappingURL=index.js.map
export declare function assert(condition: any, message?: string): asserts condition;
export declare function debounce<Fn extends (...args: any[]) => void>(callback: Fn, delay: number): Fn;

@@ -6,2 +6,14 @@ export function assert(condition, message = 'assertion failed') {

}
export function debounce(callback, delay) {
let timeout;
return ((...args) => {
if (timeout !== undefined) {
clearTimeout(timeout);
}
timeout = setTimeout(() => {
timeout = undefined;
callback(...args);
}, delay);
});
}
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "@a-type/utils",
"version": "1.0.1",
"version": "1.0.2",
"description": "",

@@ -5,0 +5,0 @@ "access": "public",

@@ -9,1 +9,17 @@ export function assert(

}
export function debounce<Fn extends (...args: any[]) => void>(
callback: Fn,
delay: number,
): Fn {
let timeout: NodeJS.Timeout | undefined;
return ((...args) => {
if (timeout !== undefined) {
clearTimeout(timeout);
}
timeout = setTimeout(() => {
timeout = undefined;
callback(...args);
}, delay);
}) as Fn;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet