Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "if-const", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"sideEffects": false, | ||
@@ -5,0 +5,0 @@ "description": "Executes blocks of code depending on thruthness of the value, while also making the value accessible to the block", |
@@ -8,3 +8,3 @@ export type Falsy = null | undefined | false | 0 | ''; | ||
type FT<T, R> = (...args: FP<T, R>) => R; | ||
type FT<T, R> = (...args: FP<T, R>) => R | undefined; | ||
@@ -21,3 +21,3 @@ export function ifConst<T>(cond: T): { | ||
? (cond ? args[0] : args[1])?.(cond as any) | ||
: (f, elf) => ifConst<T, R>(cond, f as any, elf as any); | ||
: (f, elf) => ifConst(cond, f, elf); | ||
} | ||
@@ -29,5 +29,5 @@ | ||
export function constIf<T, R>(f: F<T, R>, elf: ELF<T, R>): (cond: T) => R; | ||
export function constIf<T, R>(f: F<T, R>, elf?: ELF<T, R>): (cond: T) => R; | ||
export function constIf<T, R>(f: F<T, R>, elf?: ELF<T, R>): (cond: T) => R { | ||
return cond => ifConst(cond, f, elf as any); | ||
export function constIf<T, R>(f: F<T, R>, elf?: ELF<T, R>): (cond: T) => R | undefined; | ||
export function constIf<T, R>(f: F<T, R>, elf?: ELF<T, R>): (cond: T) => R | undefined { | ||
return cond => ifConst(cond, f, elf); | ||
} |
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
18231