@ebflat9/fp
Advanced tools
Comparing version 1.2.44 to 1.2.45
@@ -137,2 +137,10 @@ import { EventEmitter } from "events"; | ||
/** | ||
* And, satisfy both functions | ||
*/ | ||
export const and: (this: any, ...args: any[]) => any; | ||
/** | ||
* Or, satisfy one or the other functions | ||
*/ | ||
export const or: (this: any, ...args: any[]) => any; | ||
/** | ||
* Negate, reverse the sign of a numerical result of a function | ||
@@ -847,3 +855,3 @@ */ | ||
map(fn: (value: any) => any): Pair; | ||
flatMap(fn: (left: any, right: any) => [left: any, right: any]): Pair; | ||
flatMap(fn: (left: any, right: any) => [any, any]): Pair; | ||
toString(): string; | ||
@@ -874,3 +882,3 @@ toJSON(): { | ||
map(fn: (value: any) => any): Triple; | ||
flatMap(fn: (left: any, middle: any, right: any) => [left: any, middle: any, right: any]): Triple; | ||
flatMap(fn: (left: any, middle: any, right: any) => [any, any, any]): Triple; | ||
toString(): string; | ||
@@ -877,0 +885,0 @@ toJSON(): { |
{ | ||
"name": "@ebflat9/fp", | ||
"version": "1.2.44", | ||
"version": "1.2.45", | ||
"description": "my fp utils", | ||
@@ -5,0 +5,0 @@ "source": "src/index.js", |
@@ -24,3 +24,3 @@ /* eslint no-unused-vars: 0 */ | ||
} | ||
flatMap(fn: (left: any, right: any) => [left: any, right: any]) { | ||
flatMap(fn: (left: any, right: any) => [any, any]) { | ||
return new Pair(...fn(this.#left, this.#right)) | ||
@@ -72,5 +72,3 @@ } | ||
} | ||
flatMap( | ||
fn: (left: any, middle: any, right: any) => [left: any, middle: any, right: any] | ||
) { | ||
flatMap(fn: (left: any, middle: any, right: any) => [any, any, any]) { | ||
return new Triple(...fn(this.#left, this.#middle, this.#right)) | ||
@@ -77,0 +75,0 @@ } |
@@ -129,2 +129,16 @@ /* eslint complexity: 0, no-unused-vars: 0, eqeqeq: 0, no-magic-numbers: 0 */ | ||
/** | ||
* And, satisfy both functions | ||
*/ | ||
export const and = curry( | ||
(f: GenericFunction, g: GenericFunction, x: any): boolean => f(x) && g(x) | ||
) | ||
/** | ||
* Or, satisfy one or the other functions | ||
*/ | ||
export const or = curry( | ||
(f: GenericFunction, g: GenericFunction, x: any): boolean => f(x) || g(x) | ||
) | ||
/** | ||
* Negate, reverse the sign of a numerical result of a function | ||
@@ -131,0 +145,0 @@ */ |
@@ -5,2 +5,3 @@ import * as rx from './observable/Observable' | ||
accumulate, | ||
and, | ||
arity, | ||
@@ -32,2 +33,3 @@ binary, | ||
once, | ||
or, | ||
parse, | ||
@@ -34,0 +36,0 @@ pipe, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
711006
12475