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 4.2.0 to 4.2.1

21

esm/signal.js

@@ -12,1 +12,22 @@ export function signal() {

}
// todo: signal improvement (multi args + customizable)
// export type Listener<A extends any[]> = (...args: A) => void;
// export type Signal<A extends any[]> = {
// subscribe(fn: Listener<A>): () => void;
// };
// export function signal<A extends any[] = []>({
// listeners = new Set<any>(),
// emit = (fn: (...args: A) => void) => fn,
// subscribe = (fn: (fn: Listener<A>) => () => void) => fn,
// } = {}) {
// const self: any = emit((...args: A) =>
// listeners.forEach((s) => s(...args))
// );
// self.subscribe = subscribe((fn: Listener<A>) => {
// listeners.add(fn);
// return () => {
// listeners.delete(fn);
// };
// });
// return self as ((...args: A) => void) & Signal<A>;
// }

4

esm/types.d.ts

@@ -13,4 +13,4 @@ export declare class Tag<T> {

export declare type Overwrite<A, B> = Omit<A, keyof B> & B;
declare type Primitive = undefined | null | boolean | string | number | Function | Date | RegExp;
declare type NotPlainObject = Primitive | ReadonlyArray<any> | ReadonlySet<any> | ReadonlyMap<any, any>;
export declare type Primitive = undefined | boolean | string | number | symbol | bigint;
export declare type NotPlainObject = Primitive | null | Function | Date | RegExp | ReadonlyArray<any> | ReadonlySet<any> | ReadonlyMap<any, any>;
export declare type DeepReadonly<T> = T extends Primitive ? T : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer T> ? ReadonlySet<DeepReadonly<T>> : {

@@ -17,0 +17,0 @@ readonly [P in keyof T]: DeepReadonly<T[P]>;

@@ -16,1 +16,22 @@ "use strict";

exports.signal = signal;
// todo: signal improvement (multi args + customizable)
// export type Listener<A extends any[]> = (...args: A) => void;
// export type Signal<A extends any[]> = {
// subscribe(fn: Listener<A>): () => void;
// };
// export function signal<A extends any[] = []>({
// listeners = new Set<any>(),
// emit = (fn: (...args: A) => void) => fn,
// subscribe = (fn: (fn: Listener<A>) => () => void) => fn,
// } = {}) {
// const self: any = emit((...args: A) =>
// listeners.forEach((s) => s(...args))
// );
// self.subscribe = subscribe((fn: Listener<A>) => {
// listeners.add(fn);
// return () => {
// listeners.delete(fn);
// };
// });
// return self as ((...args: A) => void) & Signal<A>;
// }

@@ -13,4 +13,4 @@ export declare class Tag<T> {

export declare type Overwrite<A, B> = Omit<A, keyof B> & B;
declare type Primitive = undefined | null | boolean | string | number | Function | Date | RegExp;
declare type NotPlainObject = Primitive | ReadonlyArray<any> | ReadonlySet<any> | ReadonlyMap<any, any>;
export declare type Primitive = undefined | boolean | string | number | symbol | bigint;
export declare type NotPlainObject = Primitive | null | Function | Date | RegExp | ReadonlyArray<any> | ReadonlySet<any> | ReadonlyMap<any, any>;
export declare type DeepReadonly<T> = T extends Primitive ? T : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer T> ? ReadonlySet<DeepReadonly<T>> : {

@@ -17,0 +17,0 @@ readonly [P in keyof T]: DeepReadonly<T[P]>;

{
"name": "@dhmk/utils",
"version": "4.2.0",
"version": "4.2.1",
"description": "A collection of frequently used functions and primitives",

@@ -5,0 +5,0 @@ "keywords": [

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