@thi.ng/api
Advanced tools
Comparing version 5.1.0 to 6.0.0
146
api.d.ts
@@ -5,4 +5,11 @@ export declare const DEFAULT_EPS = 0.000001; | ||
export declare const EVENT_DISABLE = "disable"; | ||
/** | ||
* Internal use only. **Do NOT use in user land code!** | ||
*/ | ||
export declare const SEMAPHORE: unique symbol; | ||
/** | ||
* No-effect placeholder function. | ||
*/ | ||
export declare const NO_OP: () => void; | ||
export declare type ArrayLikeIterable<T> = ArrayLike<T> & Iterable<T>; | ||
/** | ||
@@ -67,5 +74,16 @@ * A no-arg function, returning T. | ||
/** | ||
* An typed vararg arg function from A => B. | ||
* A typed vararg arg function from A => B. | ||
*/ | ||
export declare type FnAnyT<A, B> = (...xs: A[]) => B; | ||
export declare type Keys<T> = keyof T; | ||
export declare type Keys1<T, A extends Keys<T>> = Keys<T[A]>; | ||
export declare type Keys2<T, A extends Keys<T>, B extends Keys1<T, A>> = Keys1<T[A], B>; | ||
export declare type Keys3<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>> = Keys2<T[A], B, C>; | ||
export declare type Keys4<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>> = Keys3<T[A], B, C, D>; | ||
export declare type Keys5<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>> = Keys4<T[A], B, C, D, E>; | ||
export declare type Val1<T, A extends Keys<T>> = T[A]; | ||
export declare type Val2<T, A extends Keys<T>, B extends Keys1<T, A>> = Val1<T, A>[B]; | ||
export declare type Val3<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>> = Val2<T, A, B>[C]; | ||
export declare type Val4<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>> = Val3<T, A, B, C>[D]; | ||
export declare type Val5<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>> = Val4<T, A, B, C, D>[E]; | ||
/** | ||
@@ -85,2 +103,3 @@ * Generic 2-element comparator function type alias. Must follow this | ||
export declare type NumericArray = number[] | TypedArray; | ||
export declare type Primitive = number | string | boolean | symbol; | ||
/** | ||
@@ -110,2 +129,6 @@ * Lookup path for nested data structures. | ||
export declare type StatefulPredicate2<T> = Fn0<Predicate2<T>>; | ||
export declare type Tuple<T, N extends number> = [T, ...T[]] & { | ||
length: N; | ||
}; | ||
export declare type IterableTuple<T, N extends number> = Tuple<T, N> & Iterable<T>; | ||
export declare type TypedArray = Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array; | ||
@@ -119,8 +142,15 @@ /** | ||
* @param V value type | ||
* @param T implementation type | ||
* @param T return type | ||
*/ | ||
export interface IAssociative<K, V, T> { | ||
export interface IAssoc<K, V, T> { | ||
assoc(key: K, val: V): T; | ||
update(key: K, f: Fn<V, V>): T; | ||
} | ||
/** | ||
* @param K key type | ||
* @param V value type | ||
* @param T return type | ||
*/ | ||
export interface IAssocIn<K, V, T> { | ||
assocIn(key: K[], val: V): T; | ||
update(key: K, f: Fn<V, V>): T; | ||
updateIn(key: K[], f: Fn<V, V>): T; | ||
@@ -202,15 +232,25 @@ } | ||
/** | ||
* Extension of `IAssociative` for types supporting key removals. | ||
* Extension of `IAssoc` for types supporting key removals. | ||
* | ||
* @param K key type | ||
* @param V value type | ||
* @param T imlementation type | ||
* @param T return type | ||
*/ | ||
export interface IDissoc<K, V, T> extends IAssociative<K, V, T> { | ||
export interface IDissoc<K, V, T> extends IAssoc<K, V, T> { | ||
dissoc(key: K): T; | ||
} | ||
/** | ||
* Extension of `IAssocIn` for types supporting key removals. | ||
* | ||
* @param K key type | ||
* @param V value type | ||
* @param T return type | ||
*/ | ||
export interface IDissocIn<K, V, T> extends IAssocIn<K, V, T> { | ||
dissocIn(key: K[]): T; | ||
} | ||
export interface IEmpty<T> { | ||
/** | ||
* Returns an empty collection of same type (and possibly same | ||
* config). | ||
* Returns an empty/blank instance of same type (with possibly same | ||
* config, if any). | ||
*/ | ||
@@ -267,9 +307,7 @@ empty(): T; | ||
/** | ||
* Interface to provide event emitter functionality. Also see `@INotify` | ||
* decorator mixin | ||
* @param K key type | ||
* @param V value type | ||
*/ | ||
export interface INotify { | ||
addListener(id: string, fn: Listener, scope?: any): boolean; | ||
removeListener(id: string, fn: Listener, scope?: any): boolean; | ||
notify(event: Event): void; | ||
export interface IGet<K, V> { | ||
get(key: K, notfound?: V): V; | ||
} | ||
@@ -280,4 +318,3 @@ /** | ||
*/ | ||
export interface IGet<K, V> { | ||
get(key: K, notfound?: V): V; | ||
export interface IGetIn<K, V> { | ||
getIn(key: K[], notfound?: V): V; | ||
@@ -313,4 +350,4 @@ } | ||
*/ | ||
export interface IInto<T> { | ||
into(coll: Iterable<T>): this; | ||
export interface IInto<V, T> { | ||
into(coll: Iterable<V>): T; | ||
} | ||
@@ -339,2 +376,11 @@ /** | ||
/** | ||
* Interface to provide event emitter functionality. Also see `@INotify` | ||
* decorator mixin | ||
*/ | ||
export interface INotify { | ||
addListener(id: string, fn: Listener, scope?: any): boolean; | ||
removeListener(id: string, fn: Listener, scope?: any): boolean; | ||
notify(event: Event): void; | ||
} | ||
/** | ||
* Generic plain object with all key values of given type. | ||
@@ -352,31 +398,10 @@ */ | ||
/** | ||
* Generic interface for MUTABLE set collection types. | ||
* Generic interface for set collection types. | ||
* | ||
* @param T value type | ||
*/ | ||
export interface ISet<T> extends IInto<T> { | ||
/** | ||
* Conjoins/adds value `x` to set and returns true if `x` has been | ||
* added. | ||
* | ||
* @param x | ||
*/ | ||
conj(x: T): boolean; | ||
/** | ||
* Disjoins/removes value `x` from set and returns true if `x` has | ||
* been removed. | ||
* | ||
* @param x | ||
*/ | ||
disj(x: T): boolean; | ||
} | ||
/** | ||
* Generic interface for IMMUTABLE set collection types. | ||
* | ||
* @param V value type | ||
* @param T implementation type | ||
* @param T return type | ||
*/ | ||
export interface IImmutableSet<V, T> extends IInto<V> { | ||
export interface ISet<V, T> extends IInto<V, T> { | ||
/** | ||
* Conjoins/adds value `x` to set and returns updated set. | ||
* Conjoins/adds value `x` to set. | ||
* | ||
@@ -387,3 +412,3 @@ * @param x | ||
/** | ||
* Disjoins/removes value `x` from set and returns updated set. | ||
* Disjoins/removes value `x` from set. | ||
* | ||
@@ -395,9 +420,10 @@ * @param x | ||
/** | ||
* Generic interface for MUTABLE sequential collections implementing | ||
* Generic interface for collections implementing | ||
* stack functionality. | ||
* | ||
* @param V value type | ||
* @param T return/container type | ||
* @param P return type for pop() | ||
* @param Q return type for push() | ||
*/ | ||
export interface IStack<V, T> { | ||
export interface IStack<V, P, Q> { | ||
/** | ||
@@ -408,25 +434,7 @@ * Returns top-of-stack item. | ||
/** | ||
* Removes top-of-stack item and returns it. | ||
* Removes top-of-stack item and returns type P. | ||
*/ | ||
pop(): V; | ||
push(x: V): T; | ||
pop(): P; | ||
push(x: V): Q; | ||
} | ||
/** | ||
* Generic interface for IMMUTABLE sequential collections implementing | ||
* stack functionality. | ||
* | ||
* @param V value type | ||
* @param T return/container type | ||
*/ | ||
export interface IImmutableStack<V, T> { | ||
/** | ||
* Returns top-of-stack item. | ||
*/ | ||
peek(): V; | ||
/** | ||
* Returns collection w/ top-of-stack item removed. | ||
*/ | ||
pop(): T; | ||
push(x: V): T; | ||
} | ||
export interface IToHiccup { | ||
@@ -433,0 +441,0 @@ /** |
@@ -5,3 +5,9 @@ export const DEFAULT_EPS = 1e-6; | ||
export const EVENT_DISABLE = "disable"; | ||
/** | ||
* Internal use only. **Do NOT use in user land code!** | ||
*/ | ||
export const SEMAPHORE = Symbol(); | ||
/** | ||
* No-effect placeholder function. | ||
*/ | ||
export const NO_OP = () => { }; |
@@ -6,3 +6,3 @@ # 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) | ||
# [6.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@5.1.0...@thi.ng/api@6.0.0) (2019-03-28) | ||
@@ -12,33 +12,30 @@ | ||
* **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)) | ||
* **api:** add new types, update existing ([560eb90](https://github.com/thi-ng/umbrella/commit/560eb90)) | ||
### BREAKING CHANGES | ||
* **api:** split up, remove & update various interfaces | ||
- split IAssociative => IAssoc, IAssocIn | ||
- update IDissoc, add IDissocIn | ||
- split IGet => IGet, IGetIn | ||
- update IInto generics & return type | ||
- update ISet, remove IImmutableSet | ||
- update IStack, remove IImmutableStack | ||
## [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) | ||
**Note:** Version bump only for package @thi.ng/api | ||
# [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) | ||
## [5.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@5.0.1...@thi.ng/api@5.0.2) (2019-02-05) | ||
### Features | ||
**Note:** Version bump only for package @thi.ng/api | ||
* **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.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@5.0.0...@thi.ng/api@5.0.1) (2019-01-21) | ||
**Note:** Version bump only for package @thi.ng/api | ||
# [5.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@4.2.4...@thi.ng/api@5.0.0) (2019-01-21) | ||
@@ -45,0 +42,0 @@ |
@@ -196,16 +196,16 @@ 'use strict'; | ||
exports.EVENT_ALL = EVENT_ALL; | ||
exports.EVENT_DISABLE = EVENT_DISABLE; | ||
exports.EVENT_ENABLE = EVENT_ENABLE; | ||
exports.EVENT_DISABLE = EVENT_DISABLE; | ||
exports.IEnableMixin = IEnableMixin; | ||
exports.INotifyMixin = INotifyMixin; | ||
exports.IWatchMixin = IWatchMixin; | ||
exports.NO_OP = NO_OP; | ||
exports.SEMAPHORE = SEMAPHORE; | ||
exports.NO_OP = NO_OP; | ||
exports.assert = assert; | ||
exports.mixin = mixin; | ||
exports.configurable = configurable; | ||
exports.deprecated = deprecated; | ||
exports.inotify_dispatch = inotify_dispatch; | ||
exports.iterable = iterable; | ||
exports.mixin = mixin; | ||
exports.nomixin = nomixin; | ||
exports.sealed = sealed; | ||
exports.IEnableMixin = IEnableMixin; | ||
exports.inotify_dispatch = inotify_dispatch; | ||
exports.INotifyMixin = INotifyMixin; | ||
exports.iterable = iterable; | ||
exports.IWatchMixin = IWatchMixin; |
@@ -196,17 +196,17 @@ (function (global, factory) { | ||
exports.EVENT_ALL = EVENT_ALL; | ||
exports.EVENT_DISABLE = EVENT_DISABLE; | ||
exports.EVENT_ENABLE = EVENT_ENABLE; | ||
exports.EVENT_DISABLE = EVENT_DISABLE; | ||
exports.IEnableMixin = IEnableMixin; | ||
exports.INotifyMixin = INotifyMixin; | ||
exports.IWatchMixin = IWatchMixin; | ||
exports.NO_OP = NO_OP; | ||
exports.SEMAPHORE = SEMAPHORE; | ||
exports.NO_OP = NO_OP; | ||
exports.assert = assert; | ||
exports.mixin = mixin; | ||
exports.configurable = configurable; | ||
exports.deprecated = deprecated; | ||
exports.inotify_dispatch = inotify_dispatch; | ||
exports.iterable = iterable; | ||
exports.mixin = mixin; | ||
exports.nomixin = nomixin; | ||
exports.sealed = sealed; | ||
exports.IEnableMixin = IEnableMixin; | ||
exports.inotify_dispatch = inotify_dispatch; | ||
exports.INotifyMixin = INotifyMixin; | ||
exports.iterable = iterable; | ||
exports.IWatchMixin = IWatchMixin; | ||
@@ -213,0 +213,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
{ | ||
"name": "@thi.ng/api", | ||
"version": "5.1.0", | ||
"version": "6.0.0", | ||
"description": "Common, generic types & interfaces for thi.ng projects", | ||
@@ -35,3 +35,3 @@ "module": "./index.js", | ||
"dependencies": { | ||
"@thi.ng/errors": "^1.0.3" | ||
"@thi.ng/errors": "^1.0.4" | ||
}, | ||
@@ -59,3 +59,3 @@ "keywords": [ | ||
"sideEffects": false, | ||
"gitHead": "794f0b6f07f6eef99f6f244d6c52c1d5de34675f" | ||
"gitHead": "1936d357f46f46d0435e3c7597b845898a91b80d" | ||
} |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
110072
34
1242
1
7
Updated@thi.ng/errors@^1.0.4