@thi.ng/api
Advanced tools
Comparing version 6.6.0 to 6.7.0
@@ -5,2 +5,4 @@ import { TypedArray } from "./api/typedarray"; | ||
* Internal use only. **Do NOT use in user land code!** | ||
* | ||
* @internal | ||
*/ | ||
@@ -21,1 +23,2 @@ export declare const SEMAPHORE: unique symbol; | ||
export declare type Pair<K, V> = [K, V]; | ||
//# sourceMappingURL=api.d.ts.map |
export const DEFAULT_EPS = 1e-6; | ||
/** | ||
* Internal use only. **Do NOT use in user land code!** | ||
* | ||
* @internal | ||
*/ | ||
export const SEMAPHORE = Symbol(); |
import { Fn } from "./fn"; | ||
/** | ||
* @param K key type | ||
* @param V value type | ||
* @param T return type | ||
* @param K - key type | ||
* @param V - value type | ||
* @param T - return type | ||
*/ | ||
@@ -12,5 +12,5 @@ export interface IAssoc<K, V, T> { | ||
/** | ||
* @param K key type | ||
* @param V value type | ||
* @param T return type | ||
* @param K - key type | ||
* @param V - value type | ||
* @param T - return type | ||
*/ | ||
@@ -21,1 +21,2 @@ export interface IAssocIn<K, V, T> { | ||
} | ||
//# sourceMappingURL=assoc.d.ts.map |
@@ -14,1 +14,2 @@ /** | ||
} | ||
//# sourceMappingURL=bind.d.ts.map |
@@ -15,1 +15,2 @@ /** | ||
} | ||
//# sourceMappingURL=buffered.d.ts.map |
import { Fn2 } from "./fn"; | ||
/** | ||
* Generic 2-element comparator function type alias. Must follow this | ||
* contract and return: | ||
* Generic 2-element comparator function type alias. | ||
* | ||
* @remarks | ||
* Must follow this contract and return: | ||
* | ||
* - negative if `a < b` | ||
@@ -17,10 +19,14 @@ * - zero if `a == b` | ||
* Compares this value with given value `x`. MUST follow same | ||
* contract as `Comparator`. MUST return 0 if the type also | ||
* implements `IEquiv` and `equiv` returns true for same `x`. | ||
* contract as {@link Comparator}. | ||
* | ||
* Also see `IHash`. | ||
* @remarks | ||
* MUST return 0 if the type also implements `IEquiv` and `equiv` | ||
* returns true for same `x`. | ||
* | ||
* @param x | ||
* Also see {@link IHash}. | ||
* | ||
* @param x - compare value | ||
*/ | ||
compare(x: T): number; | ||
} | ||
//# sourceMappingURL=compare.d.ts.map |
@@ -9,5 +9,6 @@ /** | ||
* | ||
* @param x | ||
* @param x - value to check for | ||
*/ | ||
contains(x: T): boolean; | ||
} | ||
//# sourceMappingURL=contains.d.ts.map |
@@ -11,1 +11,2 @@ /** | ||
} | ||
//# sourceMappingURL=copy.d.ts.map |
@@ -10,1 +10,2 @@ /** | ||
} | ||
//# sourceMappingURL=deref.d.ts.map |
@@ -5,5 +5,5 @@ import { IAssoc, IAssocIn } from "./assoc"; | ||
* | ||
* @param K key type | ||
* @param V value type | ||
* @param T return type | ||
* @param K - key type | ||
* @param V - value type | ||
* @param T - return type | ||
*/ | ||
@@ -16,5 +16,5 @@ export interface IDissoc<K, V, T> extends IAssoc<K, V, T> { | ||
* | ||
* @param K key type | ||
* @param V value type | ||
* @param T return type | ||
* @param K - key type | ||
* @param V - value type | ||
* @param T - return type | ||
*/ | ||
@@ -24,1 +24,2 @@ export interface IDissocIn<K, V, T> extends IAssocIn<K, V, T> { | ||
} | ||
//# sourceMappingURL=dissoc.d.ts.map |
@@ -8,1 +8,2 @@ export interface IEmpty<T> { | ||
} | ||
//# sourceMappingURL=empty.d.ts.map |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* @param T type for enable/disable option arg | ||
* @param T - type for enable/disable option arg | ||
*/ | ||
@@ -12,3 +12,3 @@ export interface IEnable<T> { | ||
* Disables this entity. | ||
* @param opts optional implementation specific arg | ||
* @param opts - optional implementation specific arg | ||
*/ | ||
@@ -18,3 +18,3 @@ disable(opts?: T): any; | ||
* Enables this entity. | ||
* @param opts optional implementation specific arg | ||
* @param opts - optional implementation specific arg | ||
*/ | ||
@@ -24,1 +24,2 @@ enable(opts?: T): any; | ||
} | ||
//# sourceMappingURL=enable.d.ts.map |
export interface IEquiv { | ||
/** | ||
* Returns `true` if this *value* is equivalent to `o`. Also see | ||
* `ICompare.compare` and `IHash.hash`. | ||
* {@link ICompare.compare} and {@link IHash.hash}. | ||
* | ||
* @param o | ||
* @param o - value to check for equivalence | ||
*/ | ||
@@ -11,3 +11,3 @@ equiv(o: any): boolean; | ||
/** | ||
* @param T value type | ||
* @param T - value type | ||
*/ | ||
@@ -19,6 +19,7 @@ export interface IEqualsDelta<T> { | ||
* | ||
* @param o 2nd value to test | ||
* @param eps tolerance (usually defaults to `DEFAULT_EPS`) | ||
* @param o - 2nd value to test | ||
* @param eps - tolerance (usually defaults to `DEFAULT_EPS`) | ||
*/ | ||
eqDelta(o: T, eps?: number): boolean; | ||
} | ||
//# sourceMappingURL=equiv.d.ts.map |
@@ -16,4 +16,4 @@ import { Fn } from "./fn"; | ||
/** | ||
* Interface to provide event emitter functionality. Also see `@INotify` | ||
* decorator mixin | ||
* Interface to provide event emitter functionality. Also see | ||
* {@link INotifyMixin} decorator mixin. | ||
*/ | ||
@@ -25,1 +25,2 @@ export interface INotify { | ||
} | ||
//# sourceMappingURL=event.d.ts.map |
@@ -10,39 +10,39 @@ /** | ||
/** | ||
* A single arg function from A => B. | ||
* A single arg function from A to B. | ||
*/ | ||
export declare type Fn<A, B> = (a: A) => B; | ||
/** | ||
* A 2-arg function from A,B => C. | ||
* A 2-arg function from A,B to C. | ||
*/ | ||
export declare type Fn2<A, B, C> = (a: A, b: B) => C; | ||
/** | ||
* A 3-arg function from A,B,C => D. | ||
* A 3-arg function from A,B,C to D. | ||
*/ | ||
export declare type Fn3<A, B, C, D> = (a: A, b: B, c: C) => D; | ||
/** | ||
* A 4-arg function from A,B,C,D => E. | ||
* A 4-arg function from A,B,C,D to 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. | ||
* A 5-arg function from A,B,C,D,E to 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. | ||
* A 6-arg function from A,B,C,D,E,F to 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. | ||
* A 7-arg function from A,B,C,D,E,F,G to 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. | ||
* A 8-arg function from A,B,C,D,E,F,G,H to 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. | ||
* A 9-arg function from A,B,C,D,E,F,G,H,I to 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. | ||
* A 10-arg function from A,B,C,D,E,F,G,H,I,J to K. | ||
*/ | ||
@@ -65,4 +65,5 @@ 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; | ||
/** | ||
* A typed vararg arg function from A => B. | ||
* A typed vararg arg function from A to B. | ||
*/ | ||
export declare type FnAnyT<A, B> = (...xs: A[]) => B; | ||
//# sourceMappingURL=fn.d.ts.map |
/** | ||
* @param K key type | ||
* @param V value type | ||
* @param K - key type | ||
* @param V - value type | ||
*/ | ||
@@ -9,4 +9,4 @@ export interface IGet<K, V> { | ||
/** | ||
* @param K key type | ||
* @param V value type | ||
* @param K - key type | ||
* @param V - value type | ||
*/ | ||
@@ -16,1 +16,2 @@ export interface IGetIn<K, V> { | ||
} | ||
//# sourceMappingURL=get.d.ts.map |
@@ -12,1 +12,2 @@ /** | ||
} | ||
//# sourceMappingURL=hash.d.ts.map |
export interface IToHiccup { | ||
/** | ||
* Returns a thi.ng/hiccup compatible representation. The optional | ||
* Returns a {@link @thi.ng/hiccup# | @thi.ng/hiccup} compatible representation. The optional | ||
* `ctx` arg is an arbitrary user context object passed to all | ||
* hiccup components during serialization (or during DOM creation / | ||
* update if used with thi.ng/hdom) | ||
* update if used with {@link @thi.ng/hdom# | @thi.ng/hdom}) | ||
* | ||
* @param ctx user context object | ||
* @param ctx - user context object | ||
*/ | ||
toHiccup(ctx?: any): any; | ||
} | ||
//# sourceMappingURL=hiccup.d.ts.map |
@@ -7,1 +7,2 @@ /** | ||
} | ||
//# sourceMappingURL=id.d.ts.map |
@@ -8,1 +8,2 @@ /** | ||
} | ||
//# sourceMappingURL=indexed.d.ts.map |
@@ -8,1 +8,2 @@ /** | ||
} | ||
//# sourceMappingURL=into.d.ts.map |
@@ -0,1 +1,2 @@ | ||
import { Head, Tail } from "./tuple"; | ||
export declare type Keys<T> = keyof T; | ||
@@ -10,2 +11,19 @@ export declare type Keys1<T, A extends Keys<T>> = Keys<T[A]>; | ||
export declare type Keys8<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>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, H extends Keys7<T, A, B, C, D, E, F, G>> = Keys7<T[A], B, C, D, E, F, G, H>; | ||
/** | ||
* Internal type used as a reducer for the KeyN type. | ||
* | ||
* @internal | ||
* | ||
* @param T - structure to validate the key against. | ||
* @param L - Current value. | ||
* @param R - Remaining values. | ||
*/ | ||
declare type KeysNReducer<T, L, R extends unknown[]> = L extends keyof T ? { | ||
0: keyof T[L]; | ||
1: KeysNReducer<T[L], Head<R>, Tail<R>>; | ||
}[R extends [] ? 0 : 1] : never; | ||
/** | ||
* Generalised version of Keys0 - Keys7. | ||
*/ | ||
export declare type KeysN<T, L extends unknown[]> = L extends [] ? Keys<T> : KeysNReducer<T, Head<L>, Tail<L>>; | ||
export declare type Val1<T, A extends Keys<T>> = T[A]; | ||
@@ -20,2 +38,19 @@ export declare type Val2<T, A extends Keys<T>, B extends Keys1<T, A>> = Val1<T, A>[B]; | ||
/** | ||
* Internal reducer for ValN. | ||
* | ||
* @internal | ||
* | ||
* @param T The structure to get the values from. | ||
* @param C The current key. | ||
* @param R The remaining keys | ||
*/ | ||
declare type ValNReducer<T, C, R extends unknown[]> = C extends keyof T ? { | ||
0: T[C]; | ||
1: ValNReducer<T[C], Head<R>, Tail<R>>; | ||
}[R extends [] ? 0 : 1] : never; | ||
/** | ||
* Generalised version of Val1-Val7 | ||
*/ | ||
export declare type ValN<T, L extends unknown[]> = L extends [] ? T : ValNReducer<T, Head<L>, Tail<L>>; | ||
/** | ||
* Utilities for constructing types with nested keys removed. | ||
@@ -46,2 +81,19 @@ */ | ||
/** | ||
* Internal reducer used as a building block for WithoutN. | ||
* | ||
* @internal | ||
* | ||
* @param T The structure to remove keys from. | ||
* @param C The current key. | ||
* @param R The remaining keys. | ||
*/ | ||
declare type WithoutNReducer<T, C, R extends unknown[]> = C extends keyof T ? { | ||
0: Without<T, C>; | ||
1: Without<T, C> & Record<C, WithoutNReducer<T[C], Head<R>, Tail<R>>>; | ||
}[R extends [] ? 0 : 1] : never; | ||
/** | ||
* Generalised version of Without0-Without8. | ||
*/ | ||
export declare type WithoutN<T, P extends unknown[]> = WithoutNReducer<T, Head<P>, Tail<P>>; | ||
/** | ||
* Utilities for replacing types of nested keys. | ||
@@ -73,1 +125,21 @@ */ | ||
}; | ||
/** | ||
* Internal reducer used as a building block for ReduceN. | ||
* | ||
* @internal | ||
* | ||
* @param T The structure to remove keys from. | ||
* @param C The current key. | ||
* @param R The remaining keys. | ||
* @param V The type to use for the replacement. | ||
*/ | ||
declare type ReplaceNReducer<T, C, R extends unknown[], V> = C extends keyof T ? { | ||
0: Replace<T, C, V>; | ||
1: Without<T, C> & Record<C, ReplaceNReducer<T[C], Head<R>, Tail<R>, V>>; | ||
}[R extends [] ? 0 : 1] : never; | ||
/** | ||
* Generalised version of Replace0-Replace8. | ||
*/ | ||
export declare type ReplaceN<T, P extends unknown[], V> = ReplaceNReducer<T, Head<P>, Tail<P>, V>; | ||
export {}; | ||
//# sourceMappingURL=keyval.d.ts.map |
@@ -8,1 +8,2 @@ /** | ||
} | ||
//# sourceMappingURL=length.d.ts.map |
@@ -20,1 +20,2 @@ export declare enum LogLevel { | ||
} | ||
//# sourceMappingURL=logger.d.ts.map |
@@ -11,5 +11,6 @@ /** | ||
* | ||
* @param meta | ||
* @param meta - meta data | ||
*/ | ||
withMeta(meta: any): T; | ||
} | ||
//# sourceMappingURL=meta.d.ts.map |
@@ -7,1 +7,2 @@ /** | ||
} | ||
//# sourceMappingURL=object.d.ts.map |
@@ -11,8 +11,9 @@ import { Fn, Fn0, Fn2 } from "./fn"; | ||
/** | ||
* Higher order `Predicate` builder. Possibly stateful. | ||
* Higher order {@link Predicate} builder. Possibly stateful. | ||
*/ | ||
export declare type StatefulPredicate<T> = Fn0<Predicate<T>>; | ||
/** | ||
* Higher order `Predicate2` builder. Possibly stateful. | ||
* Higher order {@link Predicate2} builder. Possibly stateful. | ||
*/ | ||
export declare type StatefulPredicate2<T> = Fn0<Predicate2<T>>; | ||
//# sourceMappingURL=predicate.d.ts.map |
@@ -5,3 +5,5 @@ export declare type Range0_1 = 0 | 1; | ||
export declare type Range0_15 = Range0_7 | Range8_15; | ||
export declare type Range0_23 = Range0_15 | Range16_23; | ||
export declare type Range0_31 = Range0_15 | Range16_31; | ||
export declare type Range0_47 = Range0_31 | Range32_47; | ||
export declare type Range0_63 = Range0_31 | Range32_63; | ||
@@ -12,7 +14,87 @@ export declare type Range1_2 = 1 | 2; | ||
export declare type Range1_16 = Range1_8 | Range8_15 | 16; | ||
export declare type Range1_24 = Range1_16 | Range16_23 | 24; | ||
export declare type Range1_32 = Range1_16 | Range16_31 | 32; | ||
export declare type Range1_48 = Range1_32 | Range32_47 | 48; | ||
export declare type Range1_64 = Range1_32 | Range32_63 | 64; | ||
export declare type Range4_7 = 4 | 5 | 6 | 7; | ||
export declare type Range8_15 = 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15; | ||
export declare type Range16_31 = 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31; | ||
export declare type Range32_63 = 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63; | ||
export declare type Range16_23 = 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23; | ||
export declare type Range16_31 = Range16_23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31; | ||
export declare type Range32_47 = 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47; | ||
export declare type Range48_63 = 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63; | ||
export declare type Range32_63 = Range32_47 | Range48_63; | ||
/** | ||
* Type LUT of allowed range values `[0..n)` for given range size `n`. | ||
* | ||
* @example | ||
* ``` | ||
* RangeValueMap[4] -> 0 | 1 | 2 | 3 | ||
* ``` | ||
*/ | ||
export interface RangeValueMap { | ||
1: 0; | ||
2: Range0_1; | ||
3: Range0_1 | 2; | ||
4: Range0_3; | ||
5: Range0_3 | 4; | ||
6: Range0_3 | 4 | 5; | ||
7: Range0_3 | 4 | 5 | 6; | ||
8: Range0_7; | ||
9: Range0_7 | 8; | ||
10: Range0_7 | 8 | 9; | ||
11: Range0_7 | 8 | 9 | 10; | ||
12: Range0_7 | 8 | 9 | 10 | 11; | ||
13: Range0_7 | 8 | 9 | 10 | 11 | 12; | ||
14: Range0_7 | 8 | 9 | 10 | 11 | 12 | 13; | ||
15: Range0_7 | 8 | 9 | 10 | 11 | 12 | 13 | 14; | ||
16: Range0_15; | ||
17: Range0_15 | 16; | ||
18: Range0_15 | 16 | 17; | ||
19: Range0_15 | 16 | 17 | 18; | ||
20: Range0_15 | 16 | 17 | 18 | 19; | ||
21: Range0_15 | 16 | 17 | 18 | 19 | 20; | ||
22: Range0_15 | 16 | 17 | 18 | 19 | 20 | 21; | ||
23: Range0_15 | 16 | 17 | 18 | 19 | 20 | 21 | 22; | ||
24: Range0_15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23; | ||
25: Exclude<Range0_31, 25 | 26 | 27 | 28 | 29 | 30 | 31>; | ||
26: Exclude<Range0_31, 26 | 27 | 28 | 29 | 30 | 31>; | ||
27: Exclude<Range0_31, 27 | 28 | 29 | 30 | 31>; | ||
28: Exclude<Range0_31, 28 | 29 | 30 | 31>; | ||
29: Exclude<Range0_31, 29 | 30 | 31>; | ||
30: Exclude<Range0_31, 30 | 31>; | ||
31: Exclude<Range0_31, 31>; | ||
32: Range0_31; | ||
33: Range0_31 | 32; | ||
34: Range0_31 | 32 | 33; | ||
35: Range0_31 | 32 | 33 | 34; | ||
36: Range0_31 | 32 | 33 | 34 | 35; | ||
37: Range0_31 | 32 | 33 | 34 | 35 | 36; | ||
38: Range0_31 | 32 | 33 | 34 | 35 | 36 | 37; | ||
39: Range0_31 | 32 | 33 | 34 | 35 | 36 | 37 | 38; | ||
40: Range0_31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39; | ||
41: Exclude<Range0_47, 41 | 42 | 43 | 44 | 45 | 46 | 47>; | ||
42: Exclude<Range0_47, 42 | 43 | 44 | 45 | 46 | 47>; | ||
43: Exclude<Range0_47, 43 | 44 | 45 | 46 | 47>; | ||
44: Exclude<Range0_47, 44 | 45 | 46 | 47>; | ||
45: Exclude<Range0_47, 45 | 46 | 47>; | ||
46: Exclude<Range0_47, 46 | 47>; | ||
47: Exclude<Range0_47, 47>; | ||
48: Range0_47; | ||
49: Range0_47 | 48; | ||
50: Range0_47 | 48 | 49; | ||
51: Range0_47 | 48 | 49 | 50; | ||
52: Range0_47 | 48 | 49 | 50 | 51; | ||
53: Range0_47 | 48 | 49 | 50 | 51 | 52; | ||
54: Range0_47 | 48 | 49 | 50 | 51 | 52 | 53; | ||
55: Range0_47 | 48 | 49 | 50 | 51 | 52 | 53 | 54; | ||
56: Range0_47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55; | ||
57: Exclude<Range0_63, 57 | 58 | 59 | 60 | 61 | 62 | 63>; | ||
58: Exclude<Range0_63, 58 | 59 | 60 | 61 | 62 | 63>; | ||
59: Exclude<Range0_63, 59 | 60 | 61 | 62 | 63>; | ||
60: Exclude<Range0_63, 60 | 61 | 62 | 63>; | ||
61: Exclude<Range0_63, 61 | 62 | 63>; | ||
62: Exclude<Range0_63, 62 | 63>; | ||
63: Exclude<Range0_63, 63>; | ||
64: Range0_63; | ||
} | ||
//# sourceMappingURL=range.d.ts.map |
@@ -7,1 +7,2 @@ /** | ||
} | ||
//# sourceMappingURL=release.d.ts.map |
export declare type Select2<T, Q, A, B> = T extends Q ? A : B; | ||
export declare type Select3<T, Q1, Q2, A, B, C> = T extends Q1 ? A : T extends Q2 ? B : C; | ||
export declare type Select4<T, Q1, Q2, Q3, A, B, C, D> = T extends Q1 ? A : T extends Q2 ? B : T extends Q3 ? C : D; | ||
//# sourceMappingURL=select.d.ts.map |
@@ -43,1 +43,2 @@ /** | ||
} | ||
//# sourceMappingURL=seq.d.ts.map |
@@ -5,4 +5,4 @@ import { IInto } from "./into"; | ||
* | ||
* @param V value type | ||
* @param T return type | ||
* @param V - value type | ||
* @param T - return type | ||
*/ | ||
@@ -13,3 +13,3 @@ export interface ISet<V, T> extends IInto<V, T> { | ||
* | ||
* @param x | ||
* @param x - value to add | ||
*/ | ||
@@ -20,5 +20,6 @@ conj(x: V): T; | ||
* | ||
* @param x | ||
* @param x - value to remove | ||
*/ | ||
disj(x: V): T; | ||
} | ||
//# sourceMappingURL=set.d.ts.map |
@@ -5,5 +5,5 @@ /** | ||
* | ||
* @param V value type | ||
* @param P return type for pop() | ||
* @param S return type for push() | ||
* @param V - value type | ||
* @param P - return type for pop() | ||
* @param S - return type for push() | ||
*/ | ||
@@ -21,1 +21,2 @@ export interface IStack<V, P, S> { | ||
} | ||
//# sourceMappingURL=stack.d.ts.map |
@@ -0,4 +1,73 @@ | ||
/** | ||
* Defines a fixed sized, iterable tuple with elements of type `T` and | ||
* length `N`. | ||
*/ | ||
export declare type Tuple<T, N extends number> = [T, ...T[]] & { | ||
length: N; | ||
}; | ||
} & Iterable<T>; | ||
/** | ||
* @deprecated merged w/ {@link Tuple} | ||
*/ | ||
export declare type IterableTuple<T, N extends number> = Tuple<T, N> & Iterable<T>; | ||
/** | ||
* Extracts a tuple's length / size. | ||
*/ | ||
export declare type TupleLength<T extends unknown[]> = T["length"]; | ||
/** | ||
* Extracts the first element of a tuple. | ||
*/ | ||
export declare type Head<T extends unknown[]> = T extends Parameters<(v: infer R, ...args: any[]) => any> ? R : never; | ||
/** | ||
* Extracts everything except the first element from a tuple. | ||
*/ | ||
export declare type Tail<T extends unknown[]> = ((...a: T) => void) extends (v: any, ...args: infer R) => void ? R : never; | ||
/** | ||
* Adds an element at the start of an tuple. | ||
*/ | ||
export declare type Prepend<T, U extends unknown[]> = Parameters<(v: T, ...args: U) => void>; | ||
/** | ||
* Internal version of {@link Reverse} accepting 1 extra argument for | ||
* the accumulated value. | ||
*/ | ||
declare type ReverseReducer<T extends unknown[], C extends unknown[] = []> = { | ||
0: C; | ||
1: Prepend<Head<T>, C>; | ||
2: ReverseReducer<Tail<T>, Prepend<Head<T>, C>>; | ||
}[Tail<T> extends [] ? (Head<T> extends never ? 0 : 1) : 2]; | ||
/** | ||
* Reverses the order of elements from a tuple. | ||
*/ | ||
export declare type Reverse<T extends unknown[]> = ReverseReducer<T>; | ||
/** | ||
* Extracts the last element from a tuple. | ||
*/ | ||
export declare type Last<T extends unknown[]> = { | ||
0: Head<T>; | ||
1: Last<Tail<T>>; | ||
}[Tail<T> extends [] ? 0 : 1]; | ||
/** | ||
* Internal version of {@link ButLast} accepting 1 extra argument for | ||
* the accumulated value. | ||
*/ | ||
declare type ButLastReducer<T extends unknown[], C extends unknown[] = []> = { | ||
0: Reverse<C>; | ||
1: ButLastReducer<Tail<T>, Prepend<Head<T>, C>>; | ||
}[Tail<T> extends [] ? 0 : 1]; | ||
/** | ||
* Extracts everything except the last element from a tuple. | ||
*/ | ||
export declare type ButLast<T extends unknown[]> = ButLastReducer<T>; | ||
/** | ||
* Internal version of {@link Drop} accepting 1 extra argument for the | ||
* accumulated value. | ||
*/ | ||
declare type DropReducer<T extends unknown[], C extends unknown[] = []> = { | ||
0: C; | ||
1: DropReducer<Prepend<Head<T>, C>, Tail<T>>; | ||
}[Tail<T> extends [] ? 0 : 1]; | ||
/** | ||
* Extracts everything except the first element from a tuple. | ||
*/ | ||
export declare type Drop<T extends unknown[]> = DropReducer<T>; | ||
export {}; | ||
//# sourceMappingURL=tuple.d.ts.map |
@@ -9,5 +9,5 @@ export declare type TypedArray = Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array; | ||
* | ||
* @see GLType | ||
* @see GL2TYPE | ||
* @see TYPE2GL | ||
* {@link GLType} | ||
* {@link GL2TYPE} | ||
* {@link TYPE2GL} | ||
*/ | ||
@@ -29,7 +29,7 @@ export declare const enum Type { | ||
/** | ||
* WebGL numeric type constants. Use `GL2TYPE` to convert, if needed. | ||
* WebGL numeric type constants. Use {@link GL2TYPE} to convert, if needed. | ||
* | ||
* @see Type | ||
* @see GL2TYPE | ||
* @see TYPE2GL | ||
* {@link Type} | ||
* {@link GL2TYPE} | ||
* {@link TYPE2GL} | ||
*/ | ||
@@ -46,7 +46,7 @@ export declare const enum GLType { | ||
/** | ||
* Conversion from `GLType` to `Type` enums. | ||
* Conversion from {@link GLType} to {@link Type} enums. | ||
*/ | ||
export declare const GL2TYPE: Record<GLType, Type>; | ||
/** | ||
* Potentially lossy conversion from `Type` to `GLType` enums. | ||
* Potentially lossy conversion from {@link Type} to {@link GLType} enums. | ||
* | ||
@@ -60,3 +60,3 @@ * Not all enums are mappable: | ||
/** | ||
* Size information (in bytes) for `Type` enums. For `GLType`, use this | ||
* Size information (in bytes) for {@link Type} enums. For {@link GLType}, use this | ||
* form, e.g. `SIZEOF[GL2TYPE[GLType.F32]]` | ||
@@ -95,6 +95,6 @@ */ | ||
/** | ||
* Constructs new typed array of given `Type`/`GLType`. Supports all | ||
* Constructs new typed array of given {@link Type}/{@link GLType}. Supports all | ||
* arities of standard typed array ctors. | ||
* | ||
* @param type | ||
* @param type - array type enum | ||
*/ | ||
@@ -108,3 +108,3 @@ export declare function typedArray<T extends Type | GLType>(type: T, length: number): TypedArrayTypeMap[T]; | ||
* | ||
* @param x | ||
* @param x - value to classify | ||
*/ | ||
@@ -116,4 +116,5 @@ export declare const uintType: (x: number) => UintType; | ||
* | ||
* @param x | ||
* @param x - value to classify | ||
*/ | ||
export declare const intType: (x: number) => IntType; | ||
//# sourceMappingURL=typedarray.d.ts.map |
/** | ||
* Type enums for Typedarray-backed buffers. | ||
* | ||
* @see GLType | ||
* @see GL2TYPE | ||
* @see TYPE2GL | ||
* {@link GLType} | ||
* {@link GL2TYPE} | ||
* {@link TYPE2GL} | ||
*/ | ||
@@ -21,7 +21,7 @@ export var Type; | ||
/** | ||
* WebGL numeric type constants. Use `GL2TYPE` to convert, if needed. | ||
* WebGL numeric type constants. Use {@link GL2TYPE} to convert, if needed. | ||
* | ||
* @see Type | ||
* @see GL2TYPE | ||
* @see TYPE2GL | ||
* {@link Type} | ||
* {@link GL2TYPE} | ||
* {@link TYPE2GL} | ||
*/ | ||
@@ -39,3 +39,3 @@ export var GLType; | ||
/** | ||
* Conversion from `GLType` to `Type` enums. | ||
* Conversion from {@link GLType} to {@link Type} enums. | ||
*/ | ||
@@ -52,3 +52,3 @@ export const GL2TYPE = { | ||
/** | ||
* Potentially lossy conversion from `Type` to `GLType` enums. | ||
* Potentially lossy conversion from {@link Type} to {@link GLType} enums. | ||
* | ||
@@ -73,3 +73,3 @@ * Not all enums are mappable: | ||
/** | ||
* Size information (in bytes) for `Type` enums. For `GLType`, use this | ||
* Size information (in bytes) for {@link Type} enums. For {@link GLType}, use this | ||
* form, e.g. `SIZEOF[GL2TYPE[GLType.F32]]` | ||
@@ -113,3 +113,3 @@ */ | ||
* | ||
* @param x | ||
* @param x - value to classify | ||
*/ | ||
@@ -121,3 +121,3 @@ export const uintType = (x) => x <= 0x100 ? 0 /* U8 */ : x <= 0x10000 ? 3 /* U16 */ : 5 /* U32 */; | ||
* | ||
* @param x | ||
* @param x - value to classify | ||
*/ | ||
@@ -124,0 +124,0 @@ export const intType = (x) => x >= -0x80 && x < 0x80 |
/** | ||
* Observer function for `IWatch` implementations. | ||
* Observer function for {@link IWatch} implementations. | ||
*/ | ||
@@ -14,1 +14,2 @@ export declare type Watch<T> = (id: string, oldState: T, newState: T) => void; | ||
} | ||
//# sourceMappingURL=watch.d.ts.map |
import { Fn0 } from "./api/fn"; | ||
/** | ||
* Takes a `test` result or predicate function without args and throws | ||
* error with given `msg` if test failed (i.e. is falsy). The function | ||
* is only enabled if `NODE_ENV != "production"` or if | ||
* `UMBRELLA_ASSERTS = 1`. | ||
* error with given `msg` if test failed (i.e. is falsy). | ||
* | ||
* @remarks | ||
* The function is only enabled if `process.env.NODE_ENV != "production"` | ||
* or if the `UMBRELLA_ASSERTS` env var is set to 1. | ||
*/ | ||
export declare const assert: (test: boolean | Fn0<boolean>, msg?: string | Fn0<string>) => void; | ||
//# sourceMappingURL=assert.d.ts.map |
import { NO_OP } from "./api/fn"; | ||
/** | ||
* Takes a `test` result or predicate function without args and throws | ||
* error with given `msg` if test failed (i.e. is falsy). The function | ||
* is only enabled if `NODE_ENV != "production"` or if | ||
* `UMBRELLA_ASSERTS = 1`. | ||
* error with given `msg` if test failed (i.e. is falsy). | ||
* | ||
* @remarks | ||
* The function is only enabled if `process.env.NODE_ENV != "production"` | ||
* or if the `UMBRELLA_ASSERTS` env var is set to 1. | ||
*/ | ||
@@ -8,0 +10,0 @@ export const assert = typeof process === "undefined" || |
@@ -6,2 +6,32 @@ # Change Log | ||
# [6.7.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@6.6.0...@thi.ng/api@6.7.0) (2020-01-24) | ||
### Bug Fixes | ||
* **api:** don't use optional chaining, update assert(), exposeGlobal() ([ddfc65e](https://github.com/thi-ng/umbrella/commit/ddfc65eb120d0f509cb18458f65497cb849bd305)) | ||
### Features | ||
* **api:** add Drop, TupleLength, update Tuple ([dc79324](https://github.com/thi-ng/umbrella/commit/dc79324fbdc509b9d4dc2567b0a9106a25a62ea7)) | ||
* **api:** add exposeGlobal(), update assert(), update readme ([7981cc9](https://github.com/thi-ng/umbrella/commit/7981cc95703c95800a0346f9111276202c906c75)) | ||
* **api:** add IClear interface ([38f03ff](https://github.com/thi-ng/umbrella/commit/38f03ff205b29cd7819d3b8885c25e6b58a27381)) | ||
* **api:** add IReset interface ([d491bd0](https://github.com/thi-ng/umbrella/commit/d491bd081e3926eabab377085406b8eb93205ba0)) | ||
* **api:** add more RangeXX types & RangeValueMap ([654ea53](https://github.com/thi-ng/umbrella/commit/654ea53d068cc2b830608d6d69ab31df460eab3e)) | ||
* **api:** added the Head type ([f000a3d](https://github.com/thi-ng/umbrella/commit/f000a3d57442963363abd0aab6fe3309e711b1ab)) | ||
* **api:** added the Init type ([f6c333a](https://github.com/thi-ng/umbrella/commit/f6c333a7079a18ec7594a0ceefc2a425eead9d07)) | ||
* **api:** added the KeysN type ([e0f0e90](https://github.com/thi-ng/umbrella/commit/e0f0e9002eac4b4d3e7d39e634929a4c390d1463)) | ||
* **api:** added the Last type ([44ae2f7](https://github.com/thi-ng/umbrella/commit/44ae2f770d33fa1b25f8fc7e14b3caf5bada7bc6)) | ||
* **api:** added the Prepend type ([7bfe7a8](https://github.com/thi-ng/umbrella/commit/7bfe7a8756818b5879d698500fc203c583e185f9)) | ||
* **api:** added the ReplaceN type ([4da54ae](https://github.com/thi-ng/umbrella/commit/4da54aea15d3bd4f33b040e2220a43e1bb95ea11)) | ||
* **api:** added the Reverse type ([88cfaa4](https://github.com/thi-ng/umbrella/commit/88cfaa45bab2f85d176dc6ad9d3551a9f431d68d)) | ||
* **api:** added the Tail type ([fa59ff3](https://github.com/thi-ng/umbrella/commit/fa59ff3a5a30b9b2e226a363a18dedaca512e1db)) | ||
* **api:** added the ValN type ([b48623f](https://github.com/thi-ng/umbrella/commit/b48623fdf539962fff9bd805adf5e6b3d24fc23e)) | ||
* **api:** added the WithoutN type ([0d13af5](https://github.com/thi-ng/umbrella/commit/0d13af539bff270a15cc896515bd4cb5cf39ee0c)) | ||
# [6.6.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@6.5.0...@thi.ng/api@6.6.0) (2019-11-30) | ||
@@ -8,0 +38,0 @@ |
@@ -5,4 +5,5 @@ /** | ||
* | ||
* @param state | ||
* @param state - true, if propoerty is configurable | ||
*/ | ||
export declare const configurable: (state: boolean) => MethodDecorator; | ||
//# sourceMappingURL=configurable.d.ts.map |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* @param state | ||
* @param state - true, if propoerty is configurable | ||
*/ | ||
@@ -8,0 +8,0 @@ export const configurable = (state) => function (_, __, descriptor) { |
@@ -7,3 +7,3 @@ /** | ||
* | ||
* @param msg deprecation message | ||
* @param msg - deprecation message | ||
*/ | ||
@@ -14,1 +14,2 @@ export declare const deprecated: (msg?: string | undefined, log?: { | ||
}) => MethodDecorator; | ||
//# sourceMappingURL=deprecated.d.ts.map |
@@ -8,3 +8,3 @@ import { assert } from "../assert"; | ||
* | ||
* @param msg deprecation message | ||
* @param msg - deprecation message | ||
*/ | ||
@@ -11,0 +11,0 @@ export const deprecated = (msg, log = console.log) => function (target, prop, descriptor) { |
@@ -9,1 +9,2 @@ /** | ||
export declare const nomixin: (_: any, __: string, descriptor: PropertyDescriptor) => void; | ||
//# sourceMappingURL=nomixin.d.ts.map |
/** | ||
* Class decorator. Seals both constructor and prototype. | ||
* | ||
* @param constructor | ||
* @param constructor - class ctor to seal | ||
*/ | ||
export declare const sealed: (constructor: Function) => void; | ||
//# sourceMappingURL=sealed.d.ts.map |
/** | ||
* Class decorator. Seals both constructor and prototype. | ||
* | ||
* @param constructor | ||
* @param constructor - class ctor to seal | ||
*/ | ||
@@ -6,0 +6,0 @@ export const sealed = (constructor) => { |
@@ -5,2 +5,3 @@ export * from "./api"; | ||
export * from "./api/buffered"; | ||
export * from "./api/clear"; | ||
export * from "./api/compare"; | ||
@@ -30,2 +31,3 @@ export * from "./api/contains"; | ||
export * from "./api/release"; | ||
export * from "./api/reset"; | ||
export * from "./api/select"; | ||
@@ -39,2 +41,3 @@ export * from "./api/seq"; | ||
export * from "./assert"; | ||
export * from "./expose"; | ||
export * from "./logger"; | ||
@@ -50,1 +53,2 @@ export * from "./mixin"; | ||
export * from "./mixins/iwatch"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,2 +7,3 @@ export * from "./api"; | ||
export * from "./assert"; | ||
export * from "./expose"; | ||
export * from "./logger"; | ||
@@ -9,0 +10,0 @@ export * from "./mixin"; |
@@ -113,2 +113,17 @@ 'use strict'; | ||
const exposeGlobal = (id, value, always = false) => { | ||
const glob = typeof global !== "undefined" | ||
? global | ||
: typeof window !== "undefined" | ||
? window | ||
: undefined; | ||
if (glob && | ||
(always || | ||
typeof process === "undefined" || | ||
process.env.NODE_ENV !== "production" || | ||
process.env.UMBRELLA_ASSERTS === "1")) { | ||
glob[id] = value; | ||
} | ||
}; | ||
const NULL_LOGGER = Object.freeze({ | ||
@@ -334,2 +349,3 @@ level: exports.LogLevel.NONE, | ||
exports.deprecated = deprecated; | ||
exports.exposeGlobal = exposeGlobal; | ||
exports.inotify_dispatch = inotify_dispatch; | ||
@@ -336,0 +352,0 @@ exports.intType = intType; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e=e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.api={}))}(this,(function(e){"use strict";const t=Symbol(),i=()=>{};var n,r,o;(n=e.LogLevel||(e.LogLevel={}))[n.FINE=0]="FINE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.SEVERE=4]="SEVERE",n[n.NONE=5]="NONE",(r=e.Type||(e.Type={}))[r.U8=0]="U8",r[r.U8C=1]="U8C",r[r.I8=2]="I8",r[r.U16=3]="U16",r[r.I16=4]="I16",r[r.U32=5]="U32",r[r.I32=6]="I32",r[r.F32=7]="F32",r[r.F64=8]="F64",(o=e.GLType||(e.GLType={}))[o.I8=5120]="I8",o[o.U8=5121]="U8",o[o.I16=5122]="I16",o[o.U16=5123]="U16",o[o.I32=5124]="I32",o[o.U32=5125]="U32",o[o.F32=5126]="F32";const s={5120:2,5121:0,5122:4,5123:3,5124:6,5125:5,5126:7},l={2:5120,0:5121,1:5121,4:5122,3:5123,6:5124,6:5124,5:5125,7:5126,8:void 0},a={0:1,1:1,2:1,3:2,4:2,5:4,6:4,7:4,8:8},c={0:Uint8Array,1:Uint8ClampedArray,2:Int8Array,3:Uint16Array,4:Int16Array,5:Uint32Array,6:Int32Array,7:Float32Array,8:Float64Array,5121:Uint8Array,5120:Int8Array,5123:Uint16Array,5122:Int16Array,5125:Uint32Array,5124:Int32Array,5126:Float32Array};const h="undefined"==typeof process||"production"!==process.env.NODE_ENV||"1"===process.env.UMBRELLA_ASSERTS?(e,t="assertion failed")=>{if("function"==typeof e&&!e()||!e)throw new Error("function"==typeof t?t():t)}:i,f=Object.freeze({level:e.LogLevel.NONE,fine(){},debug(){},info(){},warn(){},severe(){}});const y=(e,t={})=>{const i=Reflect.ownKeys(e),n=Reflect.ownKeys(t),r=Symbol("isa");function o(t){for(let n of i){const i=Object.getOwnPropertyDescriptor(t.prototype,n);!i||i.configurable?Object.defineProperty(t.prototype,n,{value:e[n],writable:!0}):console.log(`not patching: ${t.name}.${n.toString()}`)}return Object.defineProperty(t.prototype,r,{value:!0}),t}for(let e of n)Object.defineProperty(o,e,{value:t[e],enumerable:t.propertyIsEnumerable(e)});return Object.defineProperty(o,Symbol.hasInstance,{value:e=>!!e[r]}),o},u=y({_enabled:!0,isEnabled(){return this._enabled},enable(){this._enabled=!0,this.notify&&this.notify({id:"enable",target:this})},disable(){this._enabled=!1,this.notify&&this.notify({id:"disable",target:this})},toggle(){return this._enabled?this.disable():this.enable(),this._enabled}}),E=(e,t)=>{if(e)for(let i,n=0,r=e.length;n<r;n++)if((i=e[n])[0].call(i[1],t),t.canceled)return},d=y({addListener(e,t,i){let n=(this._listeners=this._listeners||{})[e];return!n&&(n=this._listeners[e]=[]),-1===this.__listener(n,t,i)&&(n.push([t,i]),!0)},removeListener(e,t,i){let n;if(!(n=this._listeners))return!1;const r=n[e];if(r){const o=this.__listener(r,t,i);if(-1!==o)return r.splice(o,1),!r.length&&delete n[e],!0}return!1},notify(e){let t;if(!(t=this._listeners))return!1;void 0===e.target&&(e.target=this),E(t[e.id],e),E(t["*"],e)},__listener(e,t,i){let n=e.length;for(;--n>=0;){const r=e[n];if(r[0]===t&&r[1]===i)break}return n}}),p=y({addWatch(e,t){return this._watches=this._watches||{},!this._watches[e]&&(this._watches[e]=t,!0)},removeWatch(e){if(this._watches)return!!this._watches[e]&&(delete this._watches[e],!0)},notifyWatches(e,t){if(!this._watches)return;const i=this._watches;for(let n in i)i[n](n,e,t)}});e.ConsoleLogger=class{constructor(t,i=e.LogLevel.FINE){this.id=t,this.level=i}fine(...t){this.level<=e.LogLevel.FINE&&this.log("FINE",t)}debug(...t){this.level<=e.LogLevel.DEBUG&&this.log("DEBUG",t)}info(...t){this.level<=e.LogLevel.INFO&&this.log("INFO",t)}warn(...t){this.level<=e.LogLevel.WARN&&this.log("WARN",t)}severe(...t){this.level<=e.LogLevel.SEVERE&&this.log("SEVERE",t)}log(e,t){console.log(`[${e}] ${this.id}:`,...t)}},e.DEFAULT_EPS=1e-6,e.EVENT_ALL="*",e.EVENT_DISABLE="disable",e.EVENT_ENABLE="enable",e.GL2TYPE=s,e.IEnableMixin=u,e.INotifyMixin=d,e.IWatchMixin=p,e.NO_OP=i,e.NULL_LOGGER=f,e.SEMAPHORE=t,e.SIZEOF=a,e.TYPE2GL=l,e.TYPEDARRAY_CTORS=c,e.assert=h,e.configurable=e=>(function(t,i,n){n.configurable=e}),e.deprecated=(e,t=console.log)=>(function(i,n,r){const o=`${i.constructor.name}#${n.toString()}`,s=r.value;return h("function"==typeof s,`${o} is not a function`),r.value=function(){return t(`DEPRECATED ${o}: ${e||"will be removed soon"}`),s.apply(this,arguments)},r}),e.inotify_dispatch=E,e.intType=e=>e>=-128&&e<128?2:e>=-32768&&e<32768?4:6,e.iterable=e=>y({*[Symbol.iterator](){yield*this[e]}}),e.mixin=y,e.nomixin=(e,t,i)=>{i.configurable=!1},e.sealed=e=>{Object.seal(e),Object.seal(e.prototype)},e.typedArray=function(e,...t){return new c[e](...t)},e.uintType=e=>e<=256?0:e<=65536?3:5,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e=e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.api={}))}(this,(function(e){"use strict";const t=Symbol(),n=()=>{};var i,r,o;(i=e.LogLevel||(e.LogLevel={}))[i.FINE=0]="FINE",i[i.DEBUG=1]="DEBUG",i[i.INFO=2]="INFO",i[i.WARN=3]="WARN",i[i.SEVERE=4]="SEVERE",i[i.NONE=5]="NONE",(r=e.Type||(e.Type={}))[r.U8=0]="U8",r[r.U8C=1]="U8C",r[r.I8=2]="I8",r[r.U16=3]="U16",r[r.I16=4]="I16",r[r.U32=5]="U32",r[r.I32=6]="I32",r[r.F32=7]="F32",r[r.F64=8]="F64",(o=e.GLType||(e.GLType={}))[o.I8=5120]="I8",o[o.U8=5121]="U8",o[o.I16=5122]="I16",o[o.U16=5123]="U16",o[o.I32=5124]="I32",o[o.U32=5125]="U32",o[o.F32=5126]="F32";const s={5120:2,5121:0,5122:4,5123:3,5124:6,5125:5,5126:7},l={2:5120,0:5121,1:5121,4:5122,3:5123,6:5124,6:5124,5:5125,7:5126,8:void 0},a={0:1,1:1,2:1,3:2,4:2,5:4,6:4,7:4,8:8},c={0:Uint8Array,1:Uint8ClampedArray,2:Int8Array,3:Uint16Array,4:Int16Array,5:Uint32Array,6:Int32Array,7:Float32Array,8:Float64Array,5121:Uint8Array,5120:Int8Array,5123:Uint16Array,5122:Int16Array,5125:Uint32Array,5124:Int32Array,5126:Float32Array};const f="undefined"==typeof process||"production"!==process.env.NODE_ENV||"1"===process.env.UMBRELLA_ASSERTS?(e,t="assertion failed")=>{if("function"==typeof e&&!e()||!e)throw new Error("function"==typeof t?t():t)}:n,h=Object.freeze({level:e.LogLevel.NONE,fine(){},debug(){},info(){},warn(){},severe(){}});const d=(e,t={})=>{const n=Reflect.ownKeys(e),i=Reflect.ownKeys(t),r=Symbol("isa");function o(t){for(let i of n){const n=Object.getOwnPropertyDescriptor(t.prototype,i);!n||n.configurable?Object.defineProperty(t.prototype,i,{value:e[i],writable:!0}):console.log(`not patching: ${t.name}.${i.toString()}`)}return Object.defineProperty(t.prototype,r,{value:!0}),t}for(let e of i)Object.defineProperty(o,e,{value:t[e],enumerable:t.propertyIsEnumerable(e)});return Object.defineProperty(o,Symbol.hasInstance,{value:e=>!!e[r]}),o},y=d({_enabled:!0,isEnabled(){return this._enabled},enable(){this._enabled=!0,this.notify&&this.notify({id:"enable",target:this})},disable(){this._enabled=!1,this.notify&&this.notify({id:"disable",target:this})},toggle(){return this._enabled?this.disable():this.enable(),this._enabled}}),u=(e,t)=>{if(e)for(let n,i=0,r=e.length;i<r;i++)if(n=e[i],n[0].call(n[1],t),t.canceled)return},E=d({addListener(e,t,n){let i=(this._listeners=this._listeners||{})[e];return!i&&(i=this._listeners[e]=[]),-1===this.__listener(i,t,n)&&(i.push([t,n]),!0)},removeListener(e,t,n){let i;if(!(i=this._listeners))return!1;const r=i[e];if(r){const o=this.__listener(r,t,n);if(-1!==o)return r.splice(o,1),!r.length&&delete i[e],!0}return!1},notify(e){let t;if(!(t=this._listeners))return!1;void 0===e.target&&(e.target=this),u(t[e.id],e),u(t["*"],e)},__listener(e,t,n){let i=e.length;for(;--i>=0;){const r=e[i];if(r[0]===t&&r[1]===n)break}return i}}),p=d({addWatch(e,t){return this._watches=this._watches||{},!this._watches[e]&&(this._watches[e]=t,!0)},removeWatch(e){if(this._watches)return!!this._watches[e]&&(delete this._watches[e],!0)},notifyWatches(e,t){if(!this._watches)return;const n=this._watches;for(let i in n)n[i](i,e,t)}});e.ConsoleLogger=class{constructor(t,n=e.LogLevel.FINE){this.id=t,this.level=n}fine(...t){this.level<=e.LogLevel.FINE&&this.log("FINE",t)}debug(...t){this.level<=e.LogLevel.DEBUG&&this.log("DEBUG",t)}info(...t){this.level<=e.LogLevel.INFO&&this.log("INFO",t)}warn(...t){this.level<=e.LogLevel.WARN&&this.log("WARN",t)}severe(...t){this.level<=e.LogLevel.SEVERE&&this.log("SEVERE",t)}log(e,t){console.log(`[${e}] ${this.id}:`,...t)}},e.DEFAULT_EPS=1e-6,e.EVENT_ALL="*",e.EVENT_DISABLE="disable",e.EVENT_ENABLE="enable",e.GL2TYPE=s,e.IEnableMixin=y,e.INotifyMixin=E,e.IWatchMixin=p,e.NO_OP=n,e.NULL_LOGGER=h,e.SEMAPHORE=t,e.SIZEOF=a,e.TYPE2GL=l,e.TYPEDARRAY_CTORS=c,e.assert=f,e.configurable=e=>function(t,n,i){i.configurable=e},e.deprecated=(e,t=console.log)=>function(n,i,r){const o=`${n.constructor.name}#${i.toString()}`,s=r.value;return f("function"==typeof s,`${o} is not a function`),r.value=function(){return t(`DEPRECATED ${o}: ${e||"will be removed soon"}`),s.apply(this,arguments)},r},e.exposeGlobal=(e,t,n=!1)=>{const i="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;i&&(n||"undefined"==typeof process||"production"!==process.env.NODE_ENV||"1"===process.env.UMBRELLA_ASSERTS)&&(i[e]=t)},e.inotify_dispatch=u,e.intType=e=>e>=-128&&e<128?2:e>=-32768&&e<32768?4:6,e.iterable=e=>d({*[Symbol.iterator](){yield*this[e]}}),e.mixin=d,e.nomixin=(e,t,n)=>{n.configurable=!1},e.sealed=e=>{Object.seal(e),Object.seal(e.prototype)},e.typedArray=function(e,...t){return new c[e](...t)},e.uintType=e=>e<=256?0:e<=65536?3:5,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -14,1 +14,2 @@ import { ILogger, LogLevel } from "./api/logger"; | ||
} | ||
//# sourceMappingURL=logger.d.ts.map |
/** | ||
* Class behavior mixin based on: | ||
* http://raganwald.com/2015/06/26/decorators-in-es7.html | ||
* {@link http://raganwald.com/2015/06/26/decorators-in-es7.html} | ||
* | ||
@@ -9,6 +9,7 @@ * Additionally only injects/overwrites properties in target, which are | ||
* | ||
* @param behaviour to mixin | ||
* @param sharedBehaviour | ||
* @param behaviour - to mixin | ||
* @param sharedBehaviour - | ||
* @returns decorator function | ||
*/ | ||
export declare const mixin: (behaviour: any, sharedBehaviour?: any) => (clazz: any) => any; | ||
//# sourceMappingURL=mixin.d.ts.map |
/** | ||
* Class behavior mixin based on: | ||
* http://raganwald.com/2015/06/26/decorators-in-es7.html | ||
* {@link http://raganwald.com/2015/06/26/decorators-in-es7.html} | ||
* | ||
@@ -9,4 +9,4 @@ * Additionally only injects/overwrites properties in target, which are | ||
* | ||
* @param behaviour to mixin | ||
* @param sharedBehaviour | ||
* @param behaviour - to mixin | ||
* @param sharedBehaviour - | ||
* @returns decorator function | ||
@@ -13,0 +13,0 @@ */ |
/** | ||
* Mixin class decorator, injects IEnable default implementation, incl. | ||
* a `_enabled` property. If the target also implements the `INotify` | ||
* interface, `enable()` and `disable()` will automatically emit the | ||
* respective events. | ||
* a `_enabled` property. If the target also implements the | ||
* {@link @thi.ng/api#INotify} interface, {@link IEnable.enable} and | ||
* {@link IEnable.disable} will automatically emit the respective | ||
* events. | ||
*/ | ||
export declare const IEnableMixin: (clazz: any) => any; | ||
//# sourceMappingURL=ienable.d.ts.map |
@@ -5,5 +5,6 @@ import { EVENT_DISABLE, EVENT_ENABLE } from "../api/event"; | ||
* Mixin class decorator, injects IEnable default implementation, incl. | ||
* a `_enabled` property. If the target also implements the `INotify` | ||
* interface, `enable()` and `disable()` will automatically emit the | ||
* respective events. | ||
* a `_enabled` property. If the target also implements the | ||
* {@link @thi.ng/api#INotify} interface, {@link IEnable.enable} and | ||
* {@link IEnable.disable} will automatically emit the respective | ||
* events. | ||
*/ | ||
@@ -10,0 +11,0 @@ export const IEnableMixin = mixin({ |
@@ -9,1 +9,2 @@ import { Event } from "../api/event"; | ||
export declare const INotifyMixin: (clazz: any) => any; | ||
//# sourceMappingURL=inotify.d.ts.map |
export declare const iterable: (prop: string | number | symbol) => (clazz: any) => any; | ||
//# sourceMappingURL=iterable.d.ts.map |
export declare const IWatchMixin: (clazz: any) => any; | ||
//# sourceMappingURL=iwatch.d.ts.map |
{ | ||
"name": "@thi.ng/api", | ||
"version": "6.6.0", | ||
"version": "6.7.0", | ||
"description": "Common, generic types, interfaces & mixins", | ||
@@ -26,13 +26,15 @@ "module": "./index.js", | ||
"doc": "node_modules/.bin/typedoc --mode modules --out doc src", | ||
"doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose", | ||
"pub": "yarn build:release && yarn publish --access public" | ||
}, | ||
"devDependencies": { | ||
"@istanbuljs/nyc-config-typescript": "^0.1.3", | ||
"@types/mocha": "^5.2.6", | ||
"@types/node": "^12.12.11", | ||
"mocha": "^6.2.2", | ||
"nyc": "^14.0.0", | ||
"ts-node": "^8.5.2", | ||
"typedoc": "^0.15.2", | ||
"typescript": "^3.7.2" | ||
"@istanbuljs/nyc-config-typescript": "^1.0.1", | ||
"@microsoft/api-extractor": "^7.7.7", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^13.5.0", | ||
"mocha": "^7.0.0", | ||
"nyc": "^15.0.0", | ||
"ts-node": "^8.6.2", | ||
"typedoc": "^0.16.8", | ||
"typescript": "^3.7.5" | ||
}, | ||
@@ -57,3 +59,3 @@ "keywords": [ | ||
"sideEffects": false, | ||
"gitHead": "36c4d9e967bd80ccdbfa0f4a42f594080f95f105" | ||
"gitHead": "93d8af817724c1c5b06d80ffa2492fe5b4fb7bc4" | ||
} |
@@ -17,3 +17,6 @@ <!-- This file is generated - DO NOT EDIT! --> | ||
- [API](#api) | ||
- [Environment variables](#environment-variables) | ||
- [Authors](#authors) | ||
- [Maintainer](#maintainer) | ||
- [Contributors](#contributors) | ||
- [License](#license) | ||
@@ -45,2 +48,4 @@ | ||
Package sizes (gzipped): ESM: 2.0KB / CJS: 2.1KB / UMD: 2.1KB | ||
## Dependencies | ||
@@ -54,10 +59,29 @@ | ||
TODO | ||
### Environment variables | ||
The following env variables are used to control the behavior of some functions in production builds: | ||
- `UMBRELLA_ASSERTS` - if set to `1` the | ||
[assert](https://github.com/thi-ng/umbrella/tree/develop/packages/api/src/assert.ts) | ||
function will **always** be enabled. By default, `assert()` is | ||
disabled for production builds, i.e. if `process.env.NODE_ENV === | ||
"production"`. | ||
- `UMBRELLA_GLOBALS` - if set to `1` the | ||
[exposeGlobal](https://github.com/thi-ng/umbrella/tree/develop/packages/api/src/expose.ts) | ||
function will **always** be enabled. By default, `exposeGlobal()` is | ||
disabled for production builds, i.e. if `process.env.NODE_ENV === | ||
"production"`. | ||
## Authors | ||
Karsten Schmidt | ||
### Maintainer | ||
- Karsten Schmidt ([@postspectacular](https://github.com/postspectacular)) | ||
### Contributors | ||
- Matei Adriel ([@Mateiadrielrafael](https://github.com/Mateiadrielrafael)) | ||
## License | ||
© 2016 - 2019 Karsten Schmidt // Apache Software License 2.0 | ||
© 2016 - 2020 Karsten Schmidt // Apache Software License 2.0 |
@@ -40,2 +40,4 @@ # ${pkg.name} | ||
${pkg.size} | ||
## Dependencies | ||
@@ -51,4 +53,17 @@ | ||
TODO | ||
### Environment variables | ||
The following env variables are used to control the behavior of some functions in production builds: | ||
- `UMBRELLA_ASSERTS` - if set to `1` the | ||
[assert](https://github.com/thi-ng/umbrella/tree/develop/packages/api/src/assert.ts) | ||
function will **always** be enabled. By default, `assert()` is | ||
disabled for production builds, i.e. if `process.env.NODE_ENV === | ||
"production"`. | ||
- `UMBRELLA_GLOBALS` - if set to `1` the | ||
[exposeGlobal](https://github.com/thi-ng/umbrella/tree/develop/packages/api/src/expose.ts) | ||
function will **always** be enabled. By default, `exposeGlobal()` is | ||
disabled for production builds, i.e. if `process.env.NODE_ENV === | ||
"production"`. | ||
## Authors | ||
@@ -55,0 +70,0 @@ |
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
146025
111
2560
85
9