@typed/functions
Advanced tools
Comparing version 1.1.0 to 2.0.0
@@ -5,4 +5,4 @@ import { Apply } from './types'; | ||
* the given arguments. | ||
* @name apply<A>(list: List<any>, fn: (...args: Array<any>) => A): A | ||
* @name apply<A>(list: ArrayLike<any>, fn: (...args: Array<any>) => A): A | ||
*/ | ||
export declare const apply: Apply; |
/** | ||
* Given a list of arguments and a function, applies the function with | ||
* the given arguments. | ||
* @name apply<A>(list: List<any>, fn: (...args: Array<any>) => A): A | ||
* @name apply<A>(list: ArrayLike<any>, fn: (...args: Array<any>) => A): A | ||
*/ | ||
@@ -6,0 +6,0 @@ export var apply = function (list, f) { |
@@ -1,4 +0,3 @@ | ||
import { List } from '@typed/core'; | ||
export declare type Apply = { | ||
<A>(list: List<never>, f: () => A): A; | ||
<A>(list: ArrayLike<never>, f: () => A): A; | ||
<A, B>(list: [A], f: (a: A) => B): B; | ||
@@ -18,6 +17,6 @@ <A, B, C>(list: [A, B], f: (a: A, b: B) => C): C; | ||
<A, B, C, D, E, F>(list: [A, B, C, D, E]): (f: (a: A, b: B, c: C, d: D, e: E) => F) => F; | ||
(list: List<never>): <A>(f: () => A) => A; | ||
(list: List<any>): <A>(f: (...args: Array<any>) => A) => A; | ||
<A>(list: List<any>, f: (...args: Array<any>) => A): A; | ||
<A>(list: List<any>): (f: (...args: Array<any>) => A) => A; | ||
(list: ArrayLike<never>): <A>(f: () => A) => A; | ||
(list: ArrayLike<any>): <A>(f: (...args: Array<any>) => A) => A; | ||
<A>(list: ArrayLike<any>, f: (...args: Array<any>) => A): A; | ||
<A>(list: ArrayLike<any>): (f: (...args: Array<any>) => A) => A; | ||
}; |
@@ -1,1 +0,263 @@ | ||
export * from '@typed/core/lib.es2015/functions'; | ||
/** | ||
* @name Arity0 | ||
* @type | ||
*/ | ||
export declare type Arity0<A> = () => A; | ||
/** | ||
* @name Arity1 | ||
* @type | ||
*/ | ||
export declare type Arity1<A, B> = (value: A) => B; | ||
/** | ||
* @name Arity2 | ||
* @type | ||
*/ | ||
export declare type Arity2<A, B, C> = (a: A, b: B) => C; | ||
/** | ||
* @name Arity3 | ||
* @type | ||
*/ | ||
export declare type Arity3<A, B, C, D> = (a: A, b: B, c: C) => D; | ||
/** | ||
* @name Arity4 | ||
* @type | ||
*/ | ||
export declare type Arity4<A, B, C, D, E> = (a: A, b: B, c: C, d: D) => E; | ||
/** | ||
* @name Arity5 | ||
* @type | ||
*/ | ||
export declare type Arity5<A, B, C, D, E, F> = (a: A, b: B, c: C, d: D, e: E) => F; | ||
/** | ||
* @name Arity6 | ||
* @type | ||
*/ | ||
export declare type Arity6<A, B, C, D, E, F, G> = (a: A, b: B, c: C, d: D, e: E, f: F) => G; | ||
/** | ||
* @name Arity7 | ||
* @type | ||
*/ | ||
export declare type Arity7<A, B, C, D, E, F, G, H> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => H; | ||
/** | ||
* @name Arity8 | ||
* @type | ||
*/ | ||
export declare type Arity8<A, B, C, D, E, F, G, H, I> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H) => I; | ||
/** | ||
* @name Arity9 | ||
* @type | ||
*/ | ||
export declare type Arity9<A, B, C, D, E, F, G, H, I, J> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I) => J; | ||
/** | ||
* @name Arity10 | ||
* @type | ||
*/ | ||
export declare type Arity10<A, B, C, D, E, F, G, H, I, J, K> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J) => K; | ||
/** | ||
* @name ArityN | ||
* @type | ||
*/ | ||
export declare type ArityN<R> = (...args: Array<any>) => R; | ||
/** | ||
* @name Arity1N | ||
* @type | ||
*/ | ||
export declare type Arity1N<A, R> = (a: A, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity2N | ||
* @type | ||
*/ | ||
export declare type Arity2N<A, B, R> = (a: A, b: B, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity3N | ||
* @type | ||
*/ | ||
export declare type Arity3N<A, B, C, R> = (a: A, b: B, c: C, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity4N | ||
* @type | ||
*/ | ||
export declare type Arity4N<A, B, C, D, R> = (a: A, b: B, c: C, d: D, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity5N | ||
* @type | ||
*/ | ||
export declare type Arity5N<A, B, C, D, E, R> = (a: A, b: B, c: C, d: D, e: E, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity6N | ||
* @type | ||
*/ | ||
export declare type Arity6N<A, B, C, D, E, F, R> = (a: A, b: B, c: C, d: D, e: E, f: F, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity7N | ||
* @type | ||
*/ | ||
export declare type Arity7N<A, B, C, D, E, F, G, R> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity8N | ||
* @type | ||
*/ | ||
export declare type Arity8N<A, B, C, D, E, F, G, H, R> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity9N | ||
* @type | ||
*/ | ||
export declare type Arity9N<A, B, C, D, E, F, G, H, I, R> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity10N | ||
* @type | ||
*/ | ||
export declare type Arity10N<A, B, C, D, E, F, G, H, I, J, R> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity1Bound | ||
* @type | ||
*/ | ||
export declare type Arity1Bound<that, A, B> = (this: that, a: A) => B; | ||
/** | ||
* @name Arity2Bound | ||
* @type | ||
*/ | ||
export declare type Arity2Bound<that, A, B, C> = (this: that, a: A, b: B) => C; | ||
/** | ||
* @name Arity3Bound | ||
* @type | ||
*/ | ||
export declare type Arity3Bound<that, A, B, C, D> = (this: that, a: A, b: B, c: C) => D; | ||
/** | ||
* @name Arity4Bound | ||
* @type | ||
*/ | ||
export declare type Arity4Bound<that, A, B, C, D, E> = (this: that, a: A, b: B, c: C, d: D) => E; | ||
/** | ||
* @name Arity5Bound | ||
* @type | ||
*/ | ||
export declare type Arity5Bound<that, A, B, C, D, E, F> = (this: that, a: A, b: B, c: C, d: D, e: E) => F; | ||
/** | ||
* @name Curry2 | ||
* @type | ||
*/ | ||
export declare type Curry2<A, B, C> = { | ||
(a: A): Arity1<B, C>; | ||
(a: A, b: B): C; | ||
}; | ||
/** | ||
* @name Curry3 | ||
* @type | ||
*/ | ||
export declare type Curry3<A, B, C, D> = { | ||
(a: A): Curry2<B, C, D>; | ||
(a: A, b: B): Arity1<C, D>; | ||
(a: A, b: B, c: C): D; | ||
}; | ||
/** | ||
* @name Curry4 | ||
* @type | ||
*/ | ||
export declare type Curry4<A, B, C, D, E> = { | ||
(a: A): Curry3<B, C, D, E>; | ||
(a: A, b: B): Curry2<C, D, E>; | ||
(a: A, b: B, c: C): Arity1<D, E>; | ||
(a: A, b: B, c: C, d: D): E; | ||
}; | ||
/** | ||
* @name Curry5 | ||
* @type | ||
*/ | ||
export declare type Curry5<A, B, C, D, E, F> = { | ||
(a: A): Curry4<B, C, D, E, F>; | ||
(a: A, b: B): Curry3<C, D, E, F>; | ||
(a: A, b: B, c: C): Curry2<D, E, F>; | ||
(a: A, b: B, c: C, d: D): Arity1<E, F>; | ||
(a: A, b: B, c: C, d: D, e: E): F; | ||
}; | ||
/** | ||
* @name Curry6 | ||
* @type | ||
*/ | ||
export declare type Curry6<A, B, C, D, E, F, G> = { | ||
(a: A): Curry5<B, C, D, E, F, G>; | ||
(a: A, b: B): Curry4<C, D, E, F, G>; | ||
(a: A, b: B, c: C): Curry3<D, E, F, G>; | ||
(a: A, b: B, c: C, d: D): Curry2<E, F, G>; | ||
(a: A, b: B, c: C, d: D, e: E): Arity1<F, G>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F): G; | ||
}; | ||
/** | ||
* @name Curry7 | ||
* @type | ||
*/ | ||
export declare type Curry7<A, B, C, D, E, F, G, H> = { | ||
(a: A): Curry6<B, C, D, E, F, G, H>; | ||
(a: A, b: B): Curry5<C, D, E, F, G, H>; | ||
(a: A, b: B, c: C): Curry4<D, E, F, G, H>; | ||
(a: A, b: B, c: C, d: D): Curry3<E, F, G, H>; | ||
(a: A, b: B, c: C, d: D, e: E): Curry2<F, G, H>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F): Arity1<G, H>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G): H; | ||
}; | ||
/** | ||
* @name Curry8 | ||
* @type | ||
*/ | ||
export declare type Curry8<A, B, C, D, E, F, G, H, I> = { | ||
(a: A): Curry7<B, C, D, E, F, G, H, I>; | ||
(a: A, b: B): Curry6<C, D, E, F, G, H, I>; | ||
(a: A, b: B, c: C): Curry5<D, E, F, G, H, I>; | ||
(a: A, b: B, c: C, d: D): Curry4<E, F, G, H, I>; | ||
(a: A, b: B, c: C, d: D, e: E): Curry3<F, G, H, I>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F): Curry2<G, H, I>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G): Arity1<H, I>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H): I; | ||
}; | ||
/** | ||
* @name Curry9 | ||
* @type | ||
*/ | ||
export declare type Curry9<A, B, C, D, E, F, G, H, I, J> = { | ||
(a: A): Curry8<B, C, D, E, F, G, H, I, J>; | ||
(a: A, b: B): Curry7<C, D, E, F, G, H, I, J>; | ||
(a: A, b: B, c: C): Curry6<D, E, F, G, H, I, J>; | ||
(a: A, b: B, c: C, d: D): Curry5<E, F, G, H, I, J>; | ||
(a: A, b: B, c: C, d: D, e: E): Curry4<F, G, H, I, J>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F): Curry3<G, H, I, J>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G): Curry2<H, I, J>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H): Arity1<I, J>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I): J; | ||
}; | ||
/** | ||
* @name Curry10 | ||
* @type | ||
*/ | ||
export declare type Curry10<A, B, C, D, E, F, G, H, I, J, K> = { | ||
(a: A): Curry9<B, C, D, E, F, G, H, I, J, K>; | ||
(a: A, b: B): Curry8<C, D, E, F, G, H, I, J, K>; | ||
(a: A, b: B, c: C): Curry7<D, E, F, G, H, I, J, K>; | ||
(a: A, b: B, c: C, d: D): Curry6<E, F, G, H, I, J, K>; | ||
(a: A, b: B, c: C, d: D, e: E): Curry5<F, G, H, I, J, K>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F): Curry4<G, H, I, J, K>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G): Curry3<H, I, J, K>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H): Curry2<I, J, K>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I): Arity1<J, K>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J): K; | ||
}; | ||
/** | ||
* @name Predicate | ||
* @type | ||
*/ | ||
export declare type Predicate<A> = (value: A) => boolean; | ||
/** | ||
* @name Predicate2 | ||
* @type | ||
*/ | ||
export declare type Predicate2<A> = (a: A, b: A) => boolean; | ||
/** | ||
* @name ComparisonNumber | ||
* @type | ||
*/ | ||
export declare type ComparisonNumbers = -1 | 0 | 1; | ||
/** | ||
* @name Comparator | ||
* @type | ||
*/ | ||
export declare type Comparator<A> = (a: A, b: A) => ComparisonNumbers; |
@@ -5,4 +5,4 @@ import { Apply } from './types'; | ||
* the given arguments. | ||
* @name apply<A>(list: List<any>, fn: (...args: Array<any>) => A): A | ||
* @name apply<A>(list: ArrayLike<any>, fn: (...args: Array<any>) => A): A | ||
*/ | ||
export declare const apply: Apply; |
@@ -6,3 +6,3 @@ "use strict"; | ||
* the given arguments. | ||
* @name apply<A>(list: List<any>, fn: (...args: Array<any>) => A): A | ||
* @name apply<A>(list: ArrayLike<any>, fn: (...args: Array<any>) => A): A | ||
*/ | ||
@@ -9,0 +9,0 @@ exports.apply = function (list, f) { |
@@ -1,4 +0,3 @@ | ||
import { List } from '@typed/core'; | ||
export declare type Apply = { | ||
<A>(list: List<never>, f: () => A): A; | ||
<A>(list: ArrayLike<never>, f: () => A): A; | ||
<A, B>(list: [A], f: (a: A) => B): B; | ||
@@ -18,6 +17,6 @@ <A, B, C>(list: [A, B], f: (a: A, b: B) => C): C; | ||
<A, B, C, D, E, F>(list: [A, B, C, D, E]): (f: (a: A, b: B, c: C, d: D, e: E) => F) => F; | ||
(list: List<never>): <A>(f: () => A) => A; | ||
(list: List<any>): <A>(f: (...args: Array<any>) => A) => A; | ||
<A>(list: List<any>, f: (...args: Array<any>) => A): A; | ||
<A>(list: List<any>): (f: (...args: Array<any>) => A) => A; | ||
(list: ArrayLike<never>): <A>(f: () => A) => A; | ||
(list: ArrayLike<any>): <A>(f: (...args: Array<any>) => A) => A; | ||
<A>(list: ArrayLike<any>, f: (...args: Array<any>) => A): A; | ||
<A>(list: ArrayLike<any>): (f: (...args: Array<any>) => A) => A; | ||
}; |
@@ -1,1 +0,263 @@ | ||
export * from '@typed/core/lib.es2015/functions'; | ||
/** | ||
* @name Arity0 | ||
* @type | ||
*/ | ||
export declare type Arity0<A> = () => A; | ||
/** | ||
* @name Arity1 | ||
* @type | ||
*/ | ||
export declare type Arity1<A, B> = (value: A) => B; | ||
/** | ||
* @name Arity2 | ||
* @type | ||
*/ | ||
export declare type Arity2<A, B, C> = (a: A, b: B) => C; | ||
/** | ||
* @name Arity3 | ||
* @type | ||
*/ | ||
export declare type Arity3<A, B, C, D> = (a: A, b: B, c: C) => D; | ||
/** | ||
* @name Arity4 | ||
* @type | ||
*/ | ||
export declare type Arity4<A, B, C, D, E> = (a: A, b: B, c: C, d: D) => E; | ||
/** | ||
* @name Arity5 | ||
* @type | ||
*/ | ||
export declare type Arity5<A, B, C, D, E, F> = (a: A, b: B, c: C, d: D, e: E) => F; | ||
/** | ||
* @name Arity6 | ||
* @type | ||
*/ | ||
export declare type Arity6<A, B, C, D, E, F, G> = (a: A, b: B, c: C, d: D, e: E, f: F) => G; | ||
/** | ||
* @name Arity7 | ||
* @type | ||
*/ | ||
export declare type Arity7<A, B, C, D, E, F, G, H> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => H; | ||
/** | ||
* @name Arity8 | ||
* @type | ||
*/ | ||
export declare type Arity8<A, B, C, D, E, F, G, H, I> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H) => I; | ||
/** | ||
* @name Arity9 | ||
* @type | ||
*/ | ||
export declare type Arity9<A, B, C, D, E, F, G, H, I, J> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I) => J; | ||
/** | ||
* @name Arity10 | ||
* @type | ||
*/ | ||
export declare type Arity10<A, B, C, D, E, F, G, H, I, J, K> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J) => K; | ||
/** | ||
* @name ArityN | ||
* @type | ||
*/ | ||
export declare type ArityN<R> = (...args: Array<any>) => R; | ||
/** | ||
* @name Arity1N | ||
* @type | ||
*/ | ||
export declare type Arity1N<A, R> = (a: A, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity2N | ||
* @type | ||
*/ | ||
export declare type Arity2N<A, B, R> = (a: A, b: B, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity3N | ||
* @type | ||
*/ | ||
export declare type Arity3N<A, B, C, R> = (a: A, b: B, c: C, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity4N | ||
* @type | ||
*/ | ||
export declare type Arity4N<A, B, C, D, R> = (a: A, b: B, c: C, d: D, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity5N | ||
* @type | ||
*/ | ||
export declare type Arity5N<A, B, C, D, E, R> = (a: A, b: B, c: C, d: D, e: E, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity6N | ||
* @type | ||
*/ | ||
export declare type Arity6N<A, B, C, D, E, F, R> = (a: A, b: B, c: C, d: D, e: E, f: F, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity7N | ||
* @type | ||
*/ | ||
export declare type Arity7N<A, B, C, D, E, F, G, R> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity8N | ||
* @type | ||
*/ | ||
export declare type Arity8N<A, B, C, D, E, F, G, H, R> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity9N | ||
* @type | ||
*/ | ||
export declare type Arity9N<A, B, C, D, E, F, G, H, I, R> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity10N | ||
* @type | ||
*/ | ||
export declare type Arity10N<A, B, C, D, E, F, G, H, I, J, R> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, ...args: Array<any>) => R; | ||
/** | ||
* @name Arity1Bound | ||
* @type | ||
*/ | ||
export declare type Arity1Bound<that, A, B> = (this: that, a: A) => B; | ||
/** | ||
* @name Arity2Bound | ||
* @type | ||
*/ | ||
export declare type Arity2Bound<that, A, B, C> = (this: that, a: A, b: B) => C; | ||
/** | ||
* @name Arity3Bound | ||
* @type | ||
*/ | ||
export declare type Arity3Bound<that, A, B, C, D> = (this: that, a: A, b: B, c: C) => D; | ||
/** | ||
* @name Arity4Bound | ||
* @type | ||
*/ | ||
export declare type Arity4Bound<that, A, B, C, D, E> = (this: that, a: A, b: B, c: C, d: D) => E; | ||
/** | ||
* @name Arity5Bound | ||
* @type | ||
*/ | ||
export declare type Arity5Bound<that, A, B, C, D, E, F> = (this: that, a: A, b: B, c: C, d: D, e: E) => F; | ||
/** | ||
* @name Curry2 | ||
* @type | ||
*/ | ||
export declare type Curry2<A, B, C> = { | ||
(a: A): Arity1<B, C>; | ||
(a: A, b: B): C; | ||
}; | ||
/** | ||
* @name Curry3 | ||
* @type | ||
*/ | ||
export declare type Curry3<A, B, C, D> = { | ||
(a: A): Curry2<B, C, D>; | ||
(a: A, b: B): Arity1<C, D>; | ||
(a: A, b: B, c: C): D; | ||
}; | ||
/** | ||
* @name Curry4 | ||
* @type | ||
*/ | ||
export declare type Curry4<A, B, C, D, E> = { | ||
(a: A): Curry3<B, C, D, E>; | ||
(a: A, b: B): Curry2<C, D, E>; | ||
(a: A, b: B, c: C): Arity1<D, E>; | ||
(a: A, b: B, c: C, d: D): E; | ||
}; | ||
/** | ||
* @name Curry5 | ||
* @type | ||
*/ | ||
export declare type Curry5<A, B, C, D, E, F> = { | ||
(a: A): Curry4<B, C, D, E, F>; | ||
(a: A, b: B): Curry3<C, D, E, F>; | ||
(a: A, b: B, c: C): Curry2<D, E, F>; | ||
(a: A, b: B, c: C, d: D): Arity1<E, F>; | ||
(a: A, b: B, c: C, d: D, e: E): F; | ||
}; | ||
/** | ||
* @name Curry6 | ||
* @type | ||
*/ | ||
export declare type Curry6<A, B, C, D, E, F, G> = { | ||
(a: A): Curry5<B, C, D, E, F, G>; | ||
(a: A, b: B): Curry4<C, D, E, F, G>; | ||
(a: A, b: B, c: C): Curry3<D, E, F, G>; | ||
(a: A, b: B, c: C, d: D): Curry2<E, F, G>; | ||
(a: A, b: B, c: C, d: D, e: E): Arity1<F, G>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F): G; | ||
}; | ||
/** | ||
* @name Curry7 | ||
* @type | ||
*/ | ||
export declare type Curry7<A, B, C, D, E, F, G, H> = { | ||
(a: A): Curry6<B, C, D, E, F, G, H>; | ||
(a: A, b: B): Curry5<C, D, E, F, G, H>; | ||
(a: A, b: B, c: C): Curry4<D, E, F, G, H>; | ||
(a: A, b: B, c: C, d: D): Curry3<E, F, G, H>; | ||
(a: A, b: B, c: C, d: D, e: E): Curry2<F, G, H>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F): Arity1<G, H>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G): H; | ||
}; | ||
/** | ||
* @name Curry8 | ||
* @type | ||
*/ | ||
export declare type Curry8<A, B, C, D, E, F, G, H, I> = { | ||
(a: A): Curry7<B, C, D, E, F, G, H, I>; | ||
(a: A, b: B): Curry6<C, D, E, F, G, H, I>; | ||
(a: A, b: B, c: C): Curry5<D, E, F, G, H, I>; | ||
(a: A, b: B, c: C, d: D): Curry4<E, F, G, H, I>; | ||
(a: A, b: B, c: C, d: D, e: E): Curry3<F, G, H, I>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F): Curry2<G, H, I>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G): Arity1<H, I>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H): I; | ||
}; | ||
/** | ||
* @name Curry9 | ||
* @type | ||
*/ | ||
export declare type Curry9<A, B, C, D, E, F, G, H, I, J> = { | ||
(a: A): Curry8<B, C, D, E, F, G, H, I, J>; | ||
(a: A, b: B): Curry7<C, D, E, F, G, H, I, J>; | ||
(a: A, b: B, c: C): Curry6<D, E, F, G, H, I, J>; | ||
(a: A, b: B, c: C, d: D): Curry5<E, F, G, H, I, J>; | ||
(a: A, b: B, c: C, d: D, e: E): Curry4<F, G, H, I, J>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F): Curry3<G, H, I, J>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G): Curry2<H, I, J>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H): Arity1<I, J>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I): J; | ||
}; | ||
/** | ||
* @name Curry10 | ||
* @type | ||
*/ | ||
export declare type Curry10<A, B, C, D, E, F, G, H, I, J, K> = { | ||
(a: A): Curry9<B, C, D, E, F, G, H, I, J, K>; | ||
(a: A, b: B): Curry8<C, D, E, F, G, H, I, J, K>; | ||
(a: A, b: B, c: C): Curry7<D, E, F, G, H, I, J, K>; | ||
(a: A, b: B, c: C, d: D): Curry6<E, F, G, H, I, J, K>; | ||
(a: A, b: B, c: C, d: D, e: E): Curry5<F, G, H, I, J, K>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F): Curry4<G, H, I, J, K>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G): Curry3<H, I, J, K>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H): Curry2<I, J, K>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I): Arity1<J, K>; | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J): K; | ||
}; | ||
/** | ||
* @name Predicate | ||
* @type | ||
*/ | ||
export declare type Predicate<A> = (value: A) => boolean; | ||
/** | ||
* @name Predicate2 | ||
* @type | ||
*/ | ||
export declare type Predicate2<A> = (a: A, b: A) => boolean; | ||
/** | ||
* @name ComparisonNumber | ||
* @type | ||
*/ | ||
export declare type ComparisonNumbers = -1 | 0 | 1; | ||
/** | ||
* @name Comparator | ||
* @type | ||
*/ | ||
export declare type Comparator<A> = (a: A, b: A) => ComparisonNumbers; |
{ | ||
"name": "@typed/functions", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "Well-typed collection of functions for working with functions", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -1,2 +0,2 @@ | ||
# @typed/functions -- 1.0.0 | ||
# @typed/functions -- 1.1.0 | ||
@@ -3,0 +3,0 @@ Well-typed collection of functions for working with functions |
import { Apply } from './types' | ||
import { List } from '@typed/core' | ||
@@ -7,5 +6,5 @@ /** | ||
* the given arguments. | ||
* @name apply<A>(list: List<any>, fn: (...args: Array<any>) => A): A | ||
* @name apply<A>(list: ArrayLike<any>, fn: (...args: Array<any>) => A): A | ||
*/ | ||
export const apply: Apply = function<A>(list: List<any>, f?: (...args: Array<any>) => A) { | ||
export const apply: Apply = function<A>(list: ArrayLike<any>, f?: (...args: Array<any>) => A) { | ||
if (!f) return (f: (...args: Array<any>) => A) => __apply(list, f) | ||
@@ -16,3 +15,3 @@ | ||
function __apply<A>(list: List<any>, f: (...args: Array<any>) => A) { | ||
function __apply<A>(list: ArrayLike<any>, f: (...args: Array<any>) => A) { | ||
switch (list.length) { | ||
@@ -19,0 +18,0 @@ case 0: |
@@ -1,6 +0,4 @@ | ||
import { List } from '@typed/core' | ||
// prettier-ignore | ||
export type Apply = { | ||
<A>(list: List<never>, f: () => A): A | ||
<A>(list: ArrayLike<never>, f: () => A): A | ||
<A, B>(list: [A], f: (a: A) => B): B | ||
@@ -26,6 +24,6 @@ <A, B, C>(list: [A, B], f: (a: A, b: B) => C): C | ||
(list: List<never>): <A>(f: () => A) => A | ||
(list: List<any>): <A>(f: (...args: Array<any>) => A) => A | ||
<A>(list: List<any>, f: (...args: Array<any>) => A): A | ||
<A>(list: List<any>): (f: (...args: Array<any>) => A) => A | ||
(list: ArrayLike<never>): <A>(f: () => A) => A | ||
(list: ArrayLike<any>): <A>(f: (...args: Array<any>) => A) => A | ||
<A>(list: ArrayLike<any>, f: (...args: Array<any>) => A): A | ||
<A>(list: ArrayLike<any>): (f: (...args: Array<any>) => A) => A | ||
} |
356
src/types.ts
@@ -1,1 +0,355 @@ | ||
export * from '@typed/core/lib.es2015/functions' | ||
/** | ||
* @name Arity0 | ||
* @type | ||
*/ | ||
export type Arity0<A> = () => A | ||
/** | ||
* @name Arity1 | ||
* @type | ||
*/ | ||
export type Arity1<A, B> = (value: A) => B | ||
/** | ||
* @name Arity2 | ||
* @type | ||
*/ | ||
export type Arity2<A, B, C> = (a: A, b: B) => C | ||
/** | ||
* @name Arity3 | ||
* @type | ||
*/ | ||
export type Arity3<A, B, C, D> = (a: A, b: B, c: C) => D | ||
/** | ||
* @name Arity4 | ||
* @type | ||
*/ | ||
export type Arity4<A, B, C, D, E> = (a: A, b: B, c: C, d: D) => E | ||
/** | ||
* @name Arity5 | ||
* @type | ||
*/ | ||
export type Arity5<A, B, C, D, E, F> = (a: A, b: B, c: C, d: D, e: E) => F | ||
/** | ||
* @name Arity6 | ||
* @type | ||
*/ | ||
export type Arity6<A, B, C, D, E, F, G> = (a: A, b: B, c: C, d: D, e: E, f: F) => G | ||
/** | ||
* @name Arity7 | ||
* @type | ||
*/ | ||
export type Arity7<A, B, C, D, E, F, G, H> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => H | ||
/** | ||
* @name Arity8 | ||
* @type | ||
*/ | ||
export type Arity8<A, B, C, D, E, F, G, H, I> = ( | ||
a: A, | ||
b: B, | ||
c: C, | ||
d: D, | ||
e: E, | ||
f: F, | ||
g: G, | ||
h: H | ||
) => I | ||
/** | ||
* @name Arity9 | ||
* @type | ||
*/ | ||
export type Arity9<A, B, C, D, E, F, G, H, I, J> = ( | ||
a: A, | ||
b: B, | ||
c: C, | ||
d: D, | ||
e: E, | ||
f: F, | ||
g: G, | ||
h: H, | ||
i: I | ||
) => J | ||
/** | ||
* @name Arity10 | ||
* @type | ||
*/ | ||
export type Arity10<A, B, C, D, E, F, G, H, I, J, K> = ( | ||
a: A, | ||
b: B, | ||
c: C, | ||
d: D, | ||
e: E, | ||
f: F, | ||
g: G, | ||
h: H, | ||
i: I, | ||
j: J | ||
) => K | ||
/** | ||
* @name ArityN | ||
* @type | ||
*/ | ||
export type ArityN<R> = (...args: Array<any>) => R | ||
/** | ||
* @name Arity1N | ||
* @type | ||
*/ | ||
export type Arity1N<A, R> = (a: A, ...args: Array<any>) => R | ||
/** | ||
* @name Arity2N | ||
* @type | ||
*/ | ||
export type Arity2N<A, B, R> = (a: A, b: B, ...args: Array<any>) => R | ||
/** | ||
* @name Arity3N | ||
* @type | ||
*/ | ||
export type Arity3N<A, B, C, R> = (a: A, b: B, c: C, ...args: Array<any>) => R | ||
/** | ||
* @name Arity4N | ||
* @type | ||
*/ | ||
export type Arity4N<A, B, C, D, R> = (a: A, b: B, c: C, d: D, ...args: Array<any>) => R | ||
/** | ||
* @name Arity5N | ||
* @type | ||
*/ | ||
export type Arity5N<A, B, C, D, E, R> = (a: A, b: B, c: C, d: D, e: E, ...args: Array<any>) => R | ||
/** | ||
* @name Arity6N | ||
* @type | ||
*/ | ||
export type Arity6N<A, B, C, D, E, F, R> = ( | ||
a: A, | ||
b: B, | ||
c: C, | ||
d: D, | ||
e: E, | ||
f: F, | ||
...args: Array<any> | ||
) => R | ||
/** | ||
* @name Arity7N | ||
* @type | ||
*/ | ||
export type Arity7N<A, B, C, D, E, F, G, R> = ( | ||
a: A, | ||
b: B, | ||
c: C, | ||
d: D, | ||
e: E, | ||
f: F, | ||
g: G, | ||
...args: Array<any> | ||
) => R | ||
/** | ||
* @name Arity8N | ||
* @type | ||
*/ | ||
export type Arity8N<A, B, C, D, E, F, G, H, R> = ( | ||
a: A, | ||
b: B, | ||
c: C, | ||
d: D, | ||
e: E, | ||
f: F, | ||
g: G, | ||
h: H, | ||
...args: Array<any> | ||
) => R | ||
/** | ||
* @name Arity9N | ||
* @type | ||
*/ | ||
export type Arity9N<A, B, C, D, E, F, G, H, I, R> = ( | ||
a: A, | ||
b: B, | ||
c: C, | ||
d: D, | ||
e: E, | ||
f: F, | ||
g: G, | ||
h: H, | ||
i: I, | ||
...args: Array<any> | ||
) => R | ||
/** | ||
* @name Arity10N | ||
* @type | ||
*/ | ||
export type Arity10N<A, B, C, D, E, F, G, H, I, J, R> = ( | ||
a: A, | ||
b: B, | ||
c: C, | ||
d: D, | ||
e: E, | ||
f: F, | ||
g: G, | ||
h: H, | ||
i: I, | ||
j: J, | ||
...args: Array<any> | ||
) => R | ||
/** | ||
* @name Arity1Bound | ||
* @type | ||
*/ | ||
export type Arity1Bound<that, A, B> = (this: that, a: A) => B | ||
/** | ||
* @name Arity2Bound | ||
* @type | ||
*/ | ||
export type Arity2Bound<that, A, B, C> = (this: that, a: A, b: B) => C | ||
/** | ||
* @name Arity3Bound | ||
* @type | ||
*/ | ||
export type Arity3Bound<that, A, B, C, D> = (this: that, a: A, b: B, c: C) => D | ||
/** | ||
* @name Arity4Bound | ||
* @type | ||
*/ | ||
export type Arity4Bound<that, A, B, C, D, E> = (this: that, a: A, b: B, c: C, d: D) => E | ||
/** | ||
* @name Arity5Bound | ||
* @type | ||
*/ | ||
export type Arity5Bound<that, A, B, C, D, E, F> = (this: that, a: A, b: B, c: C, d: D, e: E) => F | ||
/** | ||
* @name Curry2 | ||
* @type | ||
*/ | ||
export type Curry2<A, B, C> = { | ||
(a: A): Arity1<B, C> | ||
(a: A, b: B): C | ||
} | ||
/** | ||
* @name Curry3 | ||
* @type | ||
*/ | ||
export type Curry3<A, B, C, D> = { | ||
(a: A): Curry2<B, C, D> | ||
(a: A, b: B): Arity1<C, D> | ||
(a: A, b: B, c: C): D | ||
} | ||
/** | ||
* @name Curry4 | ||
* @type | ||
*/ | ||
export type Curry4<A, B, C, D, E> = { | ||
(a: A): Curry3<B, C, D, E> | ||
(a: A, b: B): Curry2<C, D, E> | ||
(a: A, b: B, c: C): Arity1<D, E> | ||
(a: A, b: B, c: C, d: D): E | ||
} | ||
/** | ||
* @name Curry5 | ||
* @type | ||
*/ | ||
export type Curry5<A, B, C, D, E, F> = { | ||
(a: A): Curry4<B, C, D, E, F> | ||
(a: A, b: B): Curry3<C, D, E, F> | ||
(a: A, b: B, c: C): Curry2<D, E, F> | ||
(a: A, b: B, c: C, d: D): Arity1<E, F> | ||
(a: A, b: B, c: C, d: D, e: E): F | ||
} | ||
/** | ||
* @name Curry6 | ||
* @type | ||
*/ | ||
export type Curry6<A, B, C, D, E, F, G> = { | ||
(a: A): Curry5<B, C, D, E, F, G> | ||
(a: A, b: B): Curry4<C, D, E, F, G> | ||
(a: A, b: B, c: C): Curry3<D, E, F, G> | ||
(a: A, b: B, c: C, d: D): Curry2<E, F, G> | ||
(a: A, b: B, c: C, d: D, e: E): Arity1<F, G> | ||
(a: A, b: B, c: C, d: D, e: E, f: F): G | ||
} | ||
/** | ||
* @name Curry7 | ||
* @type | ||
*/ | ||
export type Curry7<A, B, C, D, E, F, G, H> = { | ||
(a: A): Curry6<B, C, D, E, F, G, H> | ||
(a: A, b: B): Curry5<C, D, E, F, G, H> | ||
(a: A, b: B, c: C): Curry4<D, E, F, G, H> | ||
(a: A, b: B, c: C, d: D): Curry3<E, F, G, H> | ||
(a: A, b: B, c: C, d: D, e: E): Curry2<F, G, H> | ||
(a: A, b: B, c: C, d: D, e: E, f: F): Arity1<G, H> | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G): H | ||
} | ||
/** | ||
* @name Curry8 | ||
* @type | ||
*/ | ||
export type Curry8<A, B, C, D, E, F, G, H, I> = { | ||
(a: A): Curry7<B, C, D, E, F, G, H, I> | ||
(a: A, b: B): Curry6<C, D, E, F, G, H, I> | ||
(a: A, b: B, c: C): Curry5<D, E, F, G, H, I> | ||
(a: A, b: B, c: C, d: D): Curry4<E, F, G, H, I> | ||
(a: A, b: B, c: C, d: D, e: E): Curry3<F, G, H, I> | ||
(a: A, b: B, c: C, d: D, e: E, f: F): Curry2<G, H, I> | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G): Arity1<H, I> | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H): I | ||
} | ||
/** | ||
* @name Curry9 | ||
* @type | ||
*/ | ||
export type Curry9<A, B, C, D, E, F, G, H, I, J> = { | ||
(a: A): Curry8<B, C, D, E, F, G, H, I, J> | ||
(a: A, b: B): Curry7<C, D, E, F, G, H, I, J> | ||
(a: A, b: B, c: C): Curry6<D, E, F, G, H, I, J> | ||
(a: A, b: B, c: C, d: D): Curry5<E, F, G, H, I, J> | ||
(a: A, b: B, c: C, d: D, e: E): Curry4<F, G, H, I, J> | ||
(a: A, b: B, c: C, d: D, e: E, f: F): Curry3<G, H, I, J> | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G): Curry2<H, I, J> | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H): Arity1<I, J> | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I): J | ||
} | ||
/** | ||
* @name Curry10 | ||
* @type | ||
*/ | ||
export type Curry10<A, B, C, D, E, F, G, H, I, J, K> = { | ||
(a: A): Curry9<B, C, D, E, F, G, H, I, J, K> | ||
(a: A, b: B): Curry8<C, D, E, F, G, H, I, J, K> | ||
(a: A, b: B, c: C): Curry7<D, E, F, G, H, I, J, K> | ||
(a: A, b: B, c: C, d: D): Curry6<E, F, G, H, I, J, K> | ||
(a: A, b: B, c: C, d: D, e: E): Curry5<F, G, H, I, J, K> | ||
(a: A, b: B, c: C, d: D, e: E, f: F): Curry4<G, H, I, J, K> | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G): Curry3<H, I, J, K> | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H): Curry2<I, J, K> | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I): Arity1<J, K> | ||
(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J): K | ||
} | ||
/** | ||
* @name Predicate | ||
* @type | ||
*/ | ||
export type Predicate<A> = (value: A) => boolean | ||
/** | ||
* @name Predicate2 | ||
* @type | ||
*/ | ||
export type Predicate2<A> = (a: A, b: A) => boolean | ||
/** | ||
* @name ComparisonNumber | ||
* @type | ||
*/ | ||
export type ComparisonNumbers = -1 | 0 | 1 | ||
/** | ||
* @name Comparator | ||
* @type | ||
*/ | ||
export type Comparator<A> = (a: A, b: A) => ComparisonNumbers |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143889
3018