@thi.ng/api
Advanced tools
Comparing version 5.0.3 to 5.1.0
77
api.d.ts
@@ -6,11 +6,7 @@ export declare const DEFAULT_EPS = 0.000001; | ||
export declare const SEMAPHORE: unique symbol; | ||
export declare const NO_OP: () => void; | ||
/** | ||
* Generic 2-element comparator function type alias. Must follow this | ||
* contract and return: | ||
* | ||
* - negative if `a < b` | ||
* - zero if `a == b` | ||
* - positive if `a > b` | ||
* A no-arg function, returning T. | ||
*/ | ||
export declare type Comparator<T> = (a: T, b: T) => number; | ||
export declare type Fn0<T> = () => T; | ||
/** | ||
@@ -29,9 +25,60 @@ * A single arg function from A => B. | ||
/** | ||
* A vararg arg function to type T. | ||
* A 4-arg function from A,B,C,D => E. | ||
*/ | ||
export declare type Fn4<A, B, C, D, E> = (a: A, b: B, c: C, d: D) => E; | ||
/** | ||
* A 5-arg function from A,B,C,D,E => F. | ||
*/ | ||
export declare type Fn5<A, B, C, D, E, F> = (a: A, b: B, c: C, d: D, e: E) => F; | ||
/** | ||
* A 6-arg function from A,B,C,D,E,F => G. | ||
*/ | ||
export declare type Fn6<A, B, C, D, E, F, G> = (a: A, b: B, c: C, d: D, e: E, f: F) => G; | ||
/** | ||
* A 7-arg function from A,B,C,D,E,F,G => H. | ||
*/ | ||
export declare type Fn7<A, B, C, D, E, F, G, H> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => H; | ||
/** | ||
* A 8-arg function from A,B,C,D,E,F,G,H => I. | ||
*/ | ||
export declare type Fn8<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; | ||
/** | ||
* A 9-arg function from A,B,C,D,E,F,G,H,I => J. | ||
*/ | ||
export declare type Fn9<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; | ||
/** | ||
* A 10-arg function from A,B,C,D,E,F,G,H,I,J => K. | ||
*/ | ||
export declare type Fn10<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; | ||
export declare type FnO<A, B> = (a: A, ...xs: any[]) => B; | ||
export declare type FnO2<A, B, C> = (a: A, b: B, ...xs: any[]) => C; | ||
export declare type FnO3<A, B, C, D> = (a: A, b: B, c: C, ...xs: any[]) => D; | ||
export declare type FnO4<A, B, C, D, E> = (a: A, b: B, c: C, d: D, ...xs: any[]) => E; | ||
export declare type FnO5<A, B, C, D, E, F> = (a: A, b: B, c: C, d: D, e: E, ...xs: any[]) => F; | ||
export declare type FnO6<A, B, C, D, E, F, G> = (a: A, b: B, c: C, d: D, e: E, f: F, ...xs: any[]) => G; | ||
export declare type FnO7<A, B, C, D, E, F, G, H> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, ...xs: any[]) => H; | ||
export declare type FnO8<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, ...xs: any[]) => I; | ||
export declare type FnO9<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, ...xs: any[]) => J; | ||
export declare type FnO10<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, ...xs: any[]) => K; | ||
/** | ||
* An untyped vararg arg function to type T. | ||
*/ | ||
export declare type FnAny<T> = (...xs: any[]) => T; | ||
/** | ||
* An typed vararg arg function from A => B. | ||
*/ | ||
export declare type FnAnyT<A, B> = (...xs: A[]) => B; | ||
/** | ||
* Generic 2-element comparator function type alias. Must follow this | ||
* contract and return: | ||
* | ||
* - negative if `a < b` | ||
* - zero if `a == b` | ||
* - positive if `a > b` | ||
*/ | ||
export declare type Comparator<T> = Fn2<T, T, number>; | ||
/** | ||
* Event listener. | ||
*/ | ||
export declare type Listener = (e: Event) => void; | ||
export declare type Listener = Fn<Event, void>; | ||
export declare type NumericArray = number[] | TypedArray; | ||
@@ -49,15 +96,15 @@ /** | ||
*/ | ||
export declare type Predicate<T> = (a: T) => boolean; | ||
export declare type Predicate<T> = Fn<T, boolean>; | ||
/** | ||
* Predicate function mapping given args to true/false. | ||
*/ | ||
export declare type Predicate2<T> = (a: T, b: T) => boolean; | ||
export declare type Predicate2<T> = Fn2<T, T, boolean>; | ||
/** | ||
* Higher order `Predicate` builder. Possibly stateful. | ||
*/ | ||
export declare type StatefulPredicate<T> = () => Predicate<T>; | ||
export declare type StatefulPredicate<T> = Fn0<Predicate<T>>; | ||
/** | ||
* Higher order `Predicate2` builder. Possibly stateful. | ||
*/ | ||
export declare type StatefulPredicate2<T> = () => Predicate2<T>; | ||
export declare type StatefulPredicate2<T> = Fn0<Predicate2<T>>; | ||
export declare type TypedArray = Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array; | ||
@@ -76,4 +123,4 @@ /** | ||
assocIn(key: K[], val: V): T; | ||
update(key: K, f: (v: V) => V): T; | ||
updateIn(key: K[], f: (v: V) => V): T; | ||
update(key: K, f: Fn<V, V>): T; | ||
updateIn(key: K[], f: Fn<V, V>): T; | ||
} | ||
@@ -80,0 +127,0 @@ /** |
@@ -6,1 +6,2 @@ export const DEFAULT_EPS = 1e-6; | ||
export const SEMAPHORE = Symbol(); | ||
export const NO_OP = () => { }; |
@@ -0,1 +1,2 @@ | ||
import { NO_OP } from "./api"; | ||
/** | ||
@@ -15,2 +16,2 @@ * Takes a `test` result or predicate function without args and throws | ||
} | ||
: () => { }; | ||
: NO_OP; |
@@ -6,2 +6,14 @@ # Change Log | ||
# [5.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@5.0.3...@thi.ng/api@5.1.0) (2019-03-10) | ||
### Features | ||
* **api:** add additional Fn arities ([33c7dfe](https://github.com/thi-ng/umbrella/commit/33c7dfe)) | ||
* **api:** add more Fn type aliases, update existing ([3707e61](https://github.com/thi-ng/umbrella/commit/3707e61)) | ||
## [5.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@5.0.2...@thi.ng/api@5.0.3) (2019-03-01) | ||
@@ -8,0 +20,0 @@ |
@@ -12,2 +12,3 @@ 'use strict'; | ||
const SEMAPHORE = Symbol(); | ||
const NO_OP = () => { }; | ||
@@ -22,3 +23,3 @@ const assert = typeof process === "undefined" || | ||
} | ||
: () => { }; | ||
: NO_OP; | ||
@@ -200,2 +201,3 @@ const mixin = (behaviour, sharedBehaviour = {}) => { | ||
exports.SEMAPHORE = SEMAPHORE; | ||
exports.NO_OP = NO_OP; | ||
exports.assert = assert; | ||
@@ -202,0 +204,0 @@ exports.mixin = mixin; |
@@ -12,2 +12,3 @@ (function (global, factory) { | ||
const SEMAPHORE = Symbol(); | ||
const NO_OP = () => { }; | ||
@@ -22,3 +23,3 @@ const assert = typeof process === "undefined" || | ||
} | ||
: () => { }; | ||
: NO_OP; | ||
@@ -200,2 +201,3 @@ const mixin = (behaviour, sharedBehaviour = {}) => { | ||
exports.SEMAPHORE = SEMAPHORE; | ||
exports.NO_OP = NO_OP; | ||
exports.assert = assert; | ||
@@ -202,0 +204,0 @@ exports.mixin = mixin; |
{ | ||
"name": "@thi.ng/api", | ||
"version": "5.0.3", | ||
"version": "5.1.0", | ||
"description": "Common, generic types & interfaces for thi.ng projects", | ||
@@ -58,3 +58,3 @@ "module": "./index.js", | ||
"sideEffects": false, | ||
"gitHead": "e43f57c7554fd78380bba58d37ae62ca01221eeb" | ||
"gitHead": "794f0b6f07f6eef99f6f244d6c52c1d5de34675f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
68592
1164
6