getorset-anything
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -15,3 +15,3 @@ declare type KeyOfMap<M extends Map<unknown, unknown>> = M extends Map<infer K, unknown> ? K : never; | ||
*/ | ||
export declare function mapGetOrSet<M extends Map<unknown, unknown>>(map: M, key: KeyOfMap<M>, initialValue: () => ValueOfMap<M>): ValueOfMap<M>; | ||
export declare function mapGetOrSet<M extends Map<unknown, unknown>, T extends () => ValueOfMap<M>>(map: M, key: KeyOfMap<M>, initialValue: T): ReturnType<T>; | ||
/** | ||
@@ -29,3 +29,3 @@ * Retrieve the value in an object, or if it wasn't found, set an initial value and return that. | ||
*/ | ||
export declare function objGetOrSet<O extends Record<string | number | symbol, unknown>>(obj: O, key: keyof O, initialValue: () => O[keyof O]): O[keyof O]; | ||
export declare function objGetOrSet<O extends Record<string | number | symbol, unknown>, T extends () => O[keyof O]>(obj: O, key: keyof O, initialValue: T): ReturnType<T>; | ||
export {}; |
{ | ||
"name": "getorset-anything", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"sideEffects": false, | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -41,3 +41,2 @@ # Get or Set Anything 🐊 | ||
const map = new Map<string, number[]>() | ||
@@ -55,3 +54,2 @@ | ||
const obj: Record<string, number[]> = {} | ||
@@ -58,0 +56,0 @@ |
9134
85