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

@dhmk/utils

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dhmk/utils - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

lib/index.spec.d.ts

27

lib/index.d.ts
export declare const noop: () => void;
export interface Signal<T> {
export declare type Signal<T> = T extends void ? {
emit(): void;
observe(onValue: () => void, onDispose?: () => void): () => void;
} : {
emit(value: T): void;
observe(onValue: (value: T) => void, onDispose?: () => void): () => void;
}
export declare const signal: <T>() => Signal<T>;
};
export declare const signal: <T = void>() => Signal<T>;
export declare class AggregateError extends Error {

@@ -12,9 +15,13 @@ readonly errors: ReadonlyArray<Error>;

export declare const disposable: (...fns: Function[]) => () => void;
export declare const sleep: (ms: number) => Promise<unknown>;
export declare type Deferred<T> = Promise<T> & {
resolve(value: T): void;
reject(error: Error): void;
};
export declare const sleep: (ms: number) => Promise<unknown>;
export declare const deferred: <T>() => Deferred<T>;
export declare const debounced: <T>(fn: (...args: T[]) => void, ms: number) => (...args: T[]) => void;
export declare const throttled: <T>(fn: (...args: T[]) => void, ms: number) => (...args: T[]) => void;
reject(error: Error): Deferred<T>;
} & (T extends void ? {
resolve(): Deferred<T>;
} : {
resolve(x: T): Deferred<T>;
});
export declare const deferred: <T = void>() => Deferred<T>;
export declare type Action = (...args: any[]) => void;
export declare const debounced: <T extends Action>(fn: T, ms: number) => (...args: Parameters<T>) => void;
export declare const throttled: <T extends Action>(fn: T, ms: number) => (...args: Parameters<T>) => void;

@@ -49,4 +49,10 @@ export const noop = () => { };

const p = new Promise((res, rej) => {
self.resolve = res;
self.reject = rej;
self.resolve = (x) => {
res(x);
return self;
};
self.reject = (e) => {
rej(e);
return self;
};
});

@@ -53,0 +59,0 @@ self.then = p.then.bind(p);

{
"name": "@dhmk/utils",
"version": "0.0.2",
"version": "0.0.3",
"description": "A collection of frequently used functions",

@@ -24,4 +24,5 @@ "keywords": [

"postversion": "git push && git push --tags",
"build": "rm -rf lib && tsc",
"test": "jest"
"clean": "rm -rf lib",
"build": "yarn clean && tsc",
"test": "yarn clean && jest"
},

@@ -28,0 +29,0 @@ "devDependencies": {

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