@angular-wave/angular.ts 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/angular.d.ts +4 -0
- package/@types/animations/animate-css-driver.d.ts +10 -2
- package/@types/animations/animate-css.d.ts +8 -14
- package/@types/animations/animation.d.ts +1 -3
- package/@types/animations/cache/animate-cache.d.ts +99 -0
- package/@types/animations/cache/interface.d.ts +17 -0
- package/@types/animations/interface.d.ts +15 -18
- package/@types/animations/raf/raf-scheduler.d.ts +37 -0
- package/@types/core/compile/interface.d.ts +36 -5
- package/@types/core/interpolate/interface.d.ts +7 -1
- package/@types/core/parse/ast/ast-node.d.ts +75 -38
- package/@types/core/parse/ast/ast.d.ts +0 -3
- package/@types/core/parse/interface.d.ts +2 -2
- package/@types/core/parse/interpreter.d.ts +22 -10
- package/@types/core/scope/interface.d.ts +14 -4
- package/@types/core/scope/scope.d.ts +65 -22
- package/@types/directive/form/form.d.ts +16 -4
- package/@types/directive/model/model.d.ts +6 -4
- package/@types/filters/order-by.d.ts +13 -0
- package/@types/interface.d.ts +3 -3
- package/@types/router/path/path-node.d.ts +1 -1
- package/@types/router/resolve/resolve-context.d.ts +1 -1
- package/@types/router/transition/hook-registry.d.ts +1 -1
- package/@types/router/url/url-matcher.d.ts +1 -1
- package/@types/services/sce/interface.d.ts +1 -4
- package/@types/services/sce/sce.d.ts +7 -2
- package/@types/shared/common.d.ts +100 -39
- package/@types/shared/node.d.ts +5 -5
- package/@types/shared/strings.d.ts +2 -2
- package/dist/angular-ts.esm.js +1620 -1037
- package/dist/angular-ts.umd.js +1620 -1037
- package/dist/angular-ts.umd.min.js +1 -1
- package/dist/angular-ts.umd.min.js.gz +0 -0
- package/dist/angular-ts.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/@types/animations/animate-cache.d.ts +0 -94
- package/@types/animations/raf-scheduler.d.ts +0 -35
|
@@ -46,9 +46,8 @@ export class Scope {
|
|
|
46
46
|
* @param {Scope} [parent] - Custom parent.
|
|
47
47
|
*/
|
|
48
48
|
constructor(context?: Scope, parent?: Scope);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
watchers: Map<string, Array<import("./interface.ts").Listener>>;
|
|
49
|
+
/** @ignore @type {Map<string, Array<import('./interface.ts').Listener>>} Watch listeners */
|
|
50
|
+
_watchers: Map<string, Array<import("./interface.ts").Listener>>;
|
|
52
51
|
/** @private @type {Map<String, Function[]>} Event listeners */
|
|
53
52
|
private _listeners;
|
|
54
53
|
/** @private @type {Map<string, Array<import('./interface.ts').Listener>>} Watch listeners from other proxies */
|
|
@@ -59,25 +58,26 @@ export class Scope {
|
|
|
59
58
|
private _objectListeners;
|
|
60
59
|
/** @type {Proxy<Scope>} Current proxy being operated on */
|
|
61
60
|
$proxy: ProxyConstructor;
|
|
62
|
-
/** @type {Scope}
|
|
61
|
+
/** @type {Scope} This is the reference to the Scope object with acts as the actual proxy */
|
|
63
62
|
$handler: Scope;
|
|
64
63
|
/** @type {*} Current target being called on */
|
|
65
64
|
$target: any;
|
|
66
|
-
/** @type {*} Value wrapped by the proxy */
|
|
67
|
-
$value: any;
|
|
68
65
|
/**
|
|
69
|
-
* @type {Scope[]}
|
|
66
|
+
* @ignore @type {Scope[]}
|
|
70
67
|
*/
|
|
71
|
-
|
|
68
|
+
_children: Scope[];
|
|
72
69
|
/**
|
|
73
70
|
* @type {number} Unique model ID (monotonically increasing) useful for debugging.
|
|
74
71
|
*/
|
|
75
72
|
$id: number;
|
|
76
73
|
/**
|
|
77
|
-
* @type {
|
|
74
|
+
* @type {ng.RootScopeService}
|
|
78
75
|
*/
|
|
79
|
-
$root:
|
|
80
|
-
|
|
76
|
+
$root: ng.RootScopeService;
|
|
77
|
+
/**
|
|
78
|
+
* @type {Scope | undefined}
|
|
79
|
+
*/
|
|
80
|
+
$parent: Scope | undefined;
|
|
81
81
|
/** @ignore @type {boolean} */
|
|
82
82
|
_destroyed: boolean;
|
|
83
83
|
/** @private @type {import("./interface.ts").Listener[]} A list of scheduled Event listeners */
|
|
@@ -90,14 +90,14 @@ export class Scope {
|
|
|
90
90
|
* Intercepts and handles property assignments on the target object. If a new value is
|
|
91
91
|
* an object, it will be recursively proxied.
|
|
92
92
|
*
|
|
93
|
-
* @param {Object} target - The target object.
|
|
93
|
+
* @param {Object & Record<string, any>} target - The target object.
|
|
94
94
|
* @param {string} property - The name of the property being set.
|
|
95
95
|
* @param {*} value - The new value being assigned to the property.
|
|
96
96
|
* @param {Proxy<Scope>} proxy - The proxy intercepting property access
|
|
97
97
|
* @returns {boolean} - Returns true to indicate success of the operation.
|
|
98
98
|
*/
|
|
99
99
|
set(
|
|
100
|
-
target: any,
|
|
100
|
+
target: any & Record<string, any>,
|
|
101
101
|
property: string,
|
|
102
102
|
value: any,
|
|
103
103
|
proxy: ProxyConstructor,
|
|
@@ -107,17 +107,21 @@ export class Scope {
|
|
|
107
107
|
* properties (`watch` and `sync`) and binds their methods. For other properties,
|
|
108
108
|
* it returns the value directly.
|
|
109
109
|
*
|
|
110
|
-
* @param {Object} target - The target object.
|
|
110
|
+
* @param {Object & Record<string, any>} target - The target object.
|
|
111
111
|
* @param {string|number|symbol} property - The name of the property being accessed.
|
|
112
112
|
* @param {Proxy<Scope>} proxy - The proxy object being invoked
|
|
113
113
|
* @returns {*} - The value of the property or a method if accessing `watch` or `sync`.
|
|
114
114
|
*/
|
|
115
115
|
get(
|
|
116
|
-
target: any,
|
|
116
|
+
target: any & Record<string, any>,
|
|
117
117
|
property: string | number | symbol,
|
|
118
118
|
proxy: ProxyConstructor,
|
|
119
119
|
): any;
|
|
120
|
-
|
|
120
|
+
/**
|
|
121
|
+
* @param {Object & Record<string, any>} target - The target object.
|
|
122
|
+
* @param {string} property - The name of the property being deleted
|
|
123
|
+
*/
|
|
124
|
+
deleteProperty(target: any & Record<string, any>, property: string): boolean;
|
|
121
125
|
/**
|
|
122
126
|
* Registers a watcher for a property along with a listener function. The listener
|
|
123
127
|
* function is invoked when changes to that property are detected.
|
|
@@ -131,10 +135,42 @@ export class Scope {
|
|
|
131
135
|
listenerFn?: ng.ListenerFn,
|
|
132
136
|
lazy?: boolean,
|
|
133
137
|
): () => void;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
/**
|
|
139
|
+
* @param {ng.Scope} [childInstance]
|
|
140
|
+
* @returns {Proxy<ng.Scope> & ng.Scope}
|
|
141
|
+
*/
|
|
142
|
+
$new(childInstance?: ng.Scope): ProxyConstructor & ng.Scope;
|
|
143
|
+
/**
|
|
144
|
+
* @param {ng.Scope} [instance]
|
|
145
|
+
* @returns {Proxy<ng.Scope> & ng.Scope}
|
|
146
|
+
*/
|
|
147
|
+
$newIsolate(instance?: ng.Scope): ProxyConstructor & ng.Scope;
|
|
148
|
+
/**
|
|
149
|
+
* @param {ng.Scope} parentInstance
|
|
150
|
+
* @returns {Proxy<ng.Scope> & ng.Scope}
|
|
151
|
+
*/
|
|
152
|
+
$transcluded(parentInstance: ng.Scope): ProxyConstructor & ng.Scope;
|
|
153
|
+
/**
|
|
154
|
+
* @param {string} key
|
|
155
|
+
* @param {import("./interface.ts").Listener} listener
|
|
156
|
+
*/
|
|
157
|
+
_registerForeignKey(
|
|
158
|
+
key: string,
|
|
159
|
+
listener: import("./interface.ts").Listener,
|
|
160
|
+
): void;
|
|
161
|
+
/**
|
|
162
|
+
* @param {string} key
|
|
163
|
+
* @param {number} id
|
|
164
|
+
*/
|
|
165
|
+
_deregisterForeignKey(key: string, id: number): boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Evaluates an Angular expression in the context of this scope.
|
|
168
|
+
*
|
|
169
|
+
* @param {string} expr - Angular expression to evaluate
|
|
170
|
+
* @param {Record<string, any>} [locals] - Optional local variables
|
|
171
|
+
* @returns {any}
|
|
172
|
+
*/
|
|
173
|
+
$eval(expr: string, locals?: Record<string, any>): any;
|
|
138
174
|
/**
|
|
139
175
|
* @param {Object} newTarget
|
|
140
176
|
*/
|
|
@@ -153,9 +189,9 @@ export class Scope {
|
|
|
153
189
|
/**
|
|
154
190
|
* @param {string} name
|
|
155
191
|
* @param {...any} args
|
|
156
|
-
* @returns {
|
|
192
|
+
* @returns {ng.ScopeEvent | undefined}
|
|
157
193
|
*/
|
|
158
|
-
$emit(name: string, ...args: any[]):
|
|
194
|
+
$emit(name: string, ...args: any[]): ng.ScopeEvent | undefined;
|
|
159
195
|
/**
|
|
160
196
|
* @param {string} name
|
|
161
197
|
* @param {...any} args
|
|
@@ -182,3 +218,10 @@ export class Scope {
|
|
|
182
218
|
$searchByName(name: string): ng.Scope | undefined;
|
|
183
219
|
#private;
|
|
184
220
|
}
|
|
221
|
+
export type ExpressionNode = import("../parse/ast/ast-node.ts").ExpressionNode;
|
|
222
|
+
export type LiteralNode = import("../parse/ast/ast-node.ts").LiteralNode;
|
|
223
|
+
export type BodyNode = import("../parse/ast/ast-node.ts").BodyNode;
|
|
224
|
+
export type ArrayNode = import("../parse/ast/ast-node.ts").ArrayNode;
|
|
225
|
+
export type ObjectNode = import("../parse/ast/ast-node.ts").ObjectNode;
|
|
226
|
+
export type ObjectPropertyNode =
|
|
227
|
+
import("../parse/ast/ast-node.ts").ObjectPropertyNode;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
export function setupValidity(instance: any): void;
|
|
2
|
+
/**
|
|
3
|
+
* @param {FormController|ng.NgModelController} ctrl
|
|
4
|
+
* @param {string} className
|
|
5
|
+
* @param {boolean} switchValue
|
|
6
|
+
*/
|
|
7
|
+
export function cachedToggleClass(
|
|
8
|
+
ctrl: FormController | ng.NgModelController,
|
|
9
|
+
className: string,
|
|
10
|
+
switchValue: boolean,
|
|
11
|
+
): void;
|
|
2
12
|
/**
|
|
3
13
|
* @type {{
|
|
4
14
|
* $nonscope: boolean,
|
|
@@ -74,21 +84,23 @@ export class FormController {
|
|
|
74
84
|
static $nonscope: boolean;
|
|
75
85
|
static $inject: string[];
|
|
76
86
|
/**
|
|
77
|
-
* @param {
|
|
87
|
+
* @param {HTMLFormElement} $element
|
|
78
88
|
* @param {ng.Attributes} $attrs
|
|
79
89
|
* @param {ng.Scope} $scope
|
|
80
90
|
* @param {ng.AnimateService} $animate
|
|
81
91
|
* @param {ng.InterpolateService} $interpolate
|
|
82
92
|
*/
|
|
83
93
|
constructor(
|
|
84
|
-
$element:
|
|
94
|
+
$element: HTMLFormElement,
|
|
85
95
|
$attrs: ng.Attributes,
|
|
86
96
|
$scope: ng.Scope,
|
|
87
97
|
$animate: ng.AnimateService,
|
|
88
98
|
$interpolate: ng.InterpolateService,
|
|
89
99
|
);
|
|
100
|
+
/** @type {boolean} */
|
|
101
|
+
_isAnimated: boolean;
|
|
90
102
|
_controls: any[];
|
|
91
|
-
$name:
|
|
103
|
+
$name: any;
|
|
92
104
|
/**
|
|
93
105
|
* @property {boolean} $dirty True if user has already interacted with the form.
|
|
94
106
|
*/
|
|
@@ -102,7 +114,7 @@ export class FormController {
|
|
|
102
114
|
$submitted: boolean;
|
|
103
115
|
/** @type {FormController|Object} */
|
|
104
116
|
_parentForm: FormController | any;
|
|
105
|
-
_element:
|
|
117
|
+
_element: HTMLFormElement;
|
|
106
118
|
_animate: import("../../animations/interface.ts").AnimateService;
|
|
107
119
|
$error: {};
|
|
108
120
|
_success: {};
|
|
@@ -52,7 +52,7 @@ export class NgModelController {
|
|
|
52
52
|
* @param {ng.Scope} $scope
|
|
53
53
|
* @param {ng.ExceptionHandlerService} $exceptionHandler
|
|
54
54
|
* @param {ng.Attributes} $attr
|
|
55
|
-
* @param {
|
|
55
|
+
* @param {HTMLElement} $element
|
|
56
56
|
* @param {ng.ParseService} $parse
|
|
57
57
|
* @param {ng.AnimateService} $animate
|
|
58
58
|
* @param {ng.InterpolateService} $interpolate
|
|
@@ -61,11 +61,13 @@ export class NgModelController {
|
|
|
61
61
|
$scope: ng.Scope,
|
|
62
62
|
$exceptionHandler: ng.ExceptionHandlerService,
|
|
63
63
|
$attr: ng.Attributes,
|
|
64
|
-
$element:
|
|
64
|
+
$element: HTMLElement,
|
|
65
65
|
$parse: ng.ParseService,
|
|
66
66
|
$animate: ng.AnimateService,
|
|
67
67
|
$interpolate: ng.InterpolateService,
|
|
68
68
|
);
|
|
69
|
+
/** @type {boolean} */
|
|
70
|
+
_isAnimated: boolean;
|
|
69
71
|
/** @type {any} The actual value from the control's view */
|
|
70
72
|
$viewValue: any;
|
|
71
73
|
/** @type {any} The value in the model that the control is bound to. */
|
|
@@ -97,7 +99,7 @@ export class NgModelController {
|
|
|
97
99
|
$error: {};
|
|
98
100
|
_success: {};
|
|
99
101
|
$pending: any;
|
|
100
|
-
$name:
|
|
102
|
+
$name: any;
|
|
101
103
|
_parentForm: {
|
|
102
104
|
$nonscope: boolean;
|
|
103
105
|
$addControl: Function;
|
|
@@ -144,7 +146,7 @@ export class NgModelController {
|
|
|
144
146
|
/** @type {ng.Scope} */
|
|
145
147
|
_scope: ng.Scope;
|
|
146
148
|
_attr: ng.Attributes;
|
|
147
|
-
_element:
|
|
149
|
+
_element: HTMLElement;
|
|
148
150
|
_animate: import("../../animations/interface.ts").AnimateService;
|
|
149
151
|
_parse: import("../../core/parse/interface.ts").ParseService;
|
|
150
152
|
_exceptionHandler: import("../../services/exception/interface.ts").ExceptionHandler;
|
|
@@ -6,3 +6,16 @@ export function orderByFilter($parse: ng.ParseService): ng.FilterFn;
|
|
|
6
6
|
export namespace orderByFilter {
|
|
7
7
|
let $inject: string[];
|
|
8
8
|
}
|
|
9
|
+
export type ComparisonObject = {
|
|
10
|
+
value: any;
|
|
11
|
+
tieBreaker: {
|
|
12
|
+
value: number;
|
|
13
|
+
type: string;
|
|
14
|
+
index: number;
|
|
15
|
+
};
|
|
16
|
+
predicateValues: Array<{
|
|
17
|
+
value: any;
|
|
18
|
+
type: string;
|
|
19
|
+
index: number;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
package/@types/interface.d.ts
CHANGED
|
@@ -65,7 +65,7 @@ export interface AngularBootstrapConfig {
|
|
|
65
65
|
* This helps find bugs that would break under minified code.
|
|
66
66
|
* Defaults to `false`.
|
|
67
67
|
*/
|
|
68
|
-
strictDi
|
|
68
|
+
strictDi: boolean;
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* A JavaScript expression represented as a string, typically used in interpolation bindings.
|
|
@@ -474,7 +474,7 @@ export interface TemplateLinkingFunction {
|
|
|
474
474
|
): Element;
|
|
475
475
|
}
|
|
476
476
|
export interface TemplateLinkingFunctionOptions {
|
|
477
|
-
|
|
477
|
+
_parentBoundTranscludeFn?: TranscludeFunctionObject | undefined;
|
|
478
478
|
transcludeControllers?:
|
|
479
479
|
| {
|
|
480
480
|
[controller: string]: {
|
|
@@ -482,7 +482,7 @@ export interface TemplateLinkingFunctionOptions {
|
|
|
482
482
|
};
|
|
483
483
|
}
|
|
484
484
|
| undefined;
|
|
485
|
-
|
|
485
|
+
_futureParentElement?: Element | undefined;
|
|
486
486
|
}
|
|
487
487
|
/**
|
|
488
488
|
* Configuration for ngModel behavior.
|
|
@@ -16,7 +16,7 @@ export class PathNode {
|
|
|
16
16
|
/** Sets [[paramValues]] for the node, from the values of an object hash */
|
|
17
17
|
applyRawParams(params: any): this;
|
|
18
18
|
/** Gets a specific [[Param]] metadata that belongs to the node */
|
|
19
|
-
parameter(name: any):
|
|
19
|
+
parameter(name: any): any;
|
|
20
20
|
/**
|
|
21
21
|
* @returns true if the state and parameter values for another PathNode are
|
|
22
22
|
* equal to the state and param values for this PathNode
|
|
@@ -80,7 +80,7 @@ export class ResolveContext {
|
|
|
80
80
|
* @returns {Promise<any>|any}
|
|
81
81
|
*/
|
|
82
82
|
resolvePath(when: string, trans: any): Promise<any> | any;
|
|
83
|
-
findNode(resolvable: any):
|
|
83
|
+
findNode(resolvable: any): any;
|
|
84
84
|
/**
|
|
85
85
|
* Gets the async dependencies of a Resolvable
|
|
86
86
|
*
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
*/
|
|
52
52
|
export class UrlMatcher {
|
|
53
53
|
/** @internal Given a matcher, return an array with the matcher's path segments and path params, in order */
|
|
54
|
-
static pathSegmentsAndParams(matcher: any): any;
|
|
54
|
+
static pathSegmentsAndParams(matcher: any): any[];
|
|
55
55
|
/** @internal Given a matcher, return an array with the matcher's query params */
|
|
56
56
|
static queryParams(matcher: any): any;
|
|
57
57
|
/**
|
|
@@ -8,19 +8,16 @@ export interface SCEService {
|
|
|
8
8
|
getTrusted(type: string, mayBeTrusted: any): any;
|
|
9
9
|
getTrustedCss(value: any): any;
|
|
10
10
|
getTrustedHtml(value: any): any;
|
|
11
|
-
getTrustedJs(value: any): any;
|
|
12
11
|
getTrustedResourceUrl(value: any): any;
|
|
13
12
|
getTrustedUrl(value: any): any;
|
|
14
13
|
getTrustedMediaUrl(value: any): any;
|
|
15
14
|
parse(type: string, expression: string): (context: any, locals: any) => any;
|
|
16
15
|
parseAsCss(expression: string): (context: any, locals: any) => any;
|
|
17
16
|
parseAsHtml(expression: string): (context: any, locals: any) => any;
|
|
18
|
-
parseAsJs(expression: string): (context: any, locals: any) => any;
|
|
19
17
|
parseAsResourceUrl(expression: string): (context: any, locals: any) => any;
|
|
20
18
|
parseAsUrl(expression: string): (context: any, locals: any) => any;
|
|
21
19
|
trustAs(type: string, value: any): any;
|
|
22
20
|
trustAsHtml(value: any): any;
|
|
23
|
-
trustAsJs(value: any): any;
|
|
24
21
|
trustAsResourceUrl(value: any): any;
|
|
25
22
|
trustAsUrl(value: any): any;
|
|
26
23
|
isEnabled(): boolean;
|
|
@@ -29,5 +26,5 @@ export interface SCEService {
|
|
|
29
26
|
export interface SCEDelegateService {
|
|
30
27
|
getTrusted(type: string, mayBeTrusted: any): any;
|
|
31
28
|
trustAs(type: string, value: any): any;
|
|
32
|
-
valueOf(value
|
|
29
|
+
valueOf(value?: any): any;
|
|
33
30
|
}
|
|
@@ -18,7 +18,13 @@ export class SceProvider {
|
|
|
18
18
|
* Enables/disables SCE and returns the current value.
|
|
19
19
|
*/
|
|
20
20
|
enabled: (value?: boolean | undefined, ...args: any[]) => boolean;
|
|
21
|
-
$get: (
|
|
21
|
+
$get: (
|
|
22
|
+
| string
|
|
23
|
+
| ((
|
|
24
|
+
$parse: ng.ParseService,
|
|
25
|
+
$sceDelegate: ng.SCEDelegateService,
|
|
26
|
+
) => ng.SCEService)
|
|
27
|
+
)[];
|
|
22
28
|
}
|
|
23
29
|
export namespace SCE_CONTEXTS {
|
|
24
30
|
let HTML: string;
|
|
@@ -26,7 +32,6 @@ export namespace SCE_CONTEXTS {
|
|
|
26
32
|
let MEDIA_URL: string;
|
|
27
33
|
let URL: string;
|
|
28
34
|
let RESOURCE_URL: string;
|
|
29
|
-
let JS: string;
|
|
30
35
|
}
|
|
31
36
|
/**
|
|
32
37
|
* `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict
|
|
@@ -67,36 +67,83 @@ export function defaults(
|
|
|
67
67
|
* var foo = { a: 1, b: 2, c: 3 };
|
|
68
68
|
* var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 }
|
|
69
69
|
* ```
|
|
70
|
-
* @param obj the source object
|
|
71
|
-
* @param propNames an Array of strings, which are the whitelisted property names
|
|
70
|
+
* @param {any} obj the source object
|
|
71
|
+
* @param {string | any[]} propNames an Array of strings, which are the whitelisted property names
|
|
72
72
|
*/
|
|
73
|
-
export function pick(obj: any, propNames: any):
|
|
73
|
+
export function pick(obj: any, propNames: string | any[]): Record<string, any>;
|
|
74
74
|
/**
|
|
75
75
|
* Return a copy of the object omitting the blacklisted properties.
|
|
76
|
+
* @example ```
|
|
77
|
+
|
|
78
|
+
var foo = { a: 1, b: 2, c: 3 };
|
|
79
|
+
var ab = omit(foo, ['a', 'b']); // { c: 3 }
|
|
80
|
+
```
|
|
81
|
+
* @param {{ [x: string]: any; }} obj the source object
|
|
82
|
+
* @param {string | any[]} propNames an Array of strings, which are the blacklisted property names
|
|
83
|
+
*/
|
|
84
|
+
export function omit(
|
|
85
|
+
obj: {
|
|
86
|
+
[x: string]: any;
|
|
87
|
+
},
|
|
88
|
+
propNames: string | any[],
|
|
89
|
+
): Record<string, any>;
|
|
90
|
+
/**
|
|
91
|
+
* Filters an Array or an Object's properties based on a predicate
|
|
92
|
+
* @param {Record<string, any> | ArrayLike<any>} collection
|
|
93
|
+
* @param {{ (x: any): boolean; (item: any): boolean; (val: any, key: any): boolean; (arg0: any, arg1: string): any; }} callback
|
|
94
|
+
*/
|
|
95
|
+
export function filter(
|
|
96
|
+
collection: Record<string, any> | ArrayLike<any>,
|
|
97
|
+
callback: {
|
|
98
|
+
(x: any): boolean;
|
|
99
|
+
(item: any): boolean;
|
|
100
|
+
(val: any, key: any): boolean;
|
|
101
|
+
(arg0: any, arg1: string): any;
|
|
102
|
+
},
|
|
103
|
+
): Record<string, any>;
|
|
104
|
+
/**
|
|
105
|
+
* Finds an object from an array, or a property of an object, that matches a predicate
|
|
106
|
+
* @param {{ [s: string]: any; } | ArrayLike<any>} collection
|
|
107
|
+
* @param {function} callback
|
|
108
|
+
*/
|
|
109
|
+
export function find(
|
|
110
|
+
collection:
|
|
111
|
+
| {
|
|
112
|
+
[s: string]: any;
|
|
113
|
+
}
|
|
114
|
+
| ArrayLike<any>,
|
|
115
|
+
callback: Function,
|
|
116
|
+
): any;
|
|
117
|
+
/**
|
|
118
|
+
* Maps over an array or object and returns a new collection
|
|
119
|
+
* with the same shape.
|
|
76
120
|
*
|
|
77
|
-
* @
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* @param obj the source object
|
|
84
|
-
* @param propNames an Array of strings, which are the blacklisted property names
|
|
121
|
+
* @template T
|
|
122
|
+
* @template R
|
|
123
|
+
* @param {T[] | Record<string, T>} collection
|
|
124
|
+
* @param {(value: T, key: string | number) => R} callback
|
|
125
|
+
* @param {R[] | Record<string, R>} [target]
|
|
126
|
+
* @returns {R[] | Record<string, R>}
|
|
85
127
|
*/
|
|
86
|
-
export function
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
/** Maps an array or object properties using a callback function */
|
|
92
|
-
export function map(collection: any, callback: any, target: any): any;
|
|
128
|
+
export function map<T, R>(
|
|
129
|
+
collection: T[] | Record<string, T>,
|
|
130
|
+
callback: (value: T, key: string | number) => R,
|
|
131
|
+
target?: R[] | Record<string, R>,
|
|
132
|
+
): R[] | Record<string, R>;
|
|
93
133
|
/**
|
|
94
134
|
* Reduce function that pushes an object to an array, then returns the array.
|
|
95
135
|
* Mostly just for [[flattenR]] and [[uniqR]]
|
|
136
|
+
* @param {any[]} arr
|
|
137
|
+
* @param {unknown} obj
|
|
138
|
+
*/
|
|
139
|
+
export function pushR(arr: any[], obj: unknown): any[];
|
|
140
|
+
/**
|
|
141
|
+
* @param {(arg0: any) => any} predicateOrMap
|
|
142
|
+
* @param {string} errMsg
|
|
143
|
+
* @return {(obj:any) => any}
|
|
96
144
|
*/
|
|
97
|
-
export function pushR(arr: any, obj: any): any;
|
|
98
145
|
export function assertFn(
|
|
99
|
-
predicateOrMap: any,
|
|
146
|
+
predicateOrMap: (arg0: any) => any,
|
|
100
147
|
errMsg?: string,
|
|
101
148
|
): (obj: any) => any;
|
|
102
149
|
/**
|
|
@@ -119,21 +166,28 @@ export function arrayTuples(...args: any[][]): any[][];
|
|
|
119
166
|
* Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration.
|
|
120
167
|
*
|
|
121
168
|
* Each keyValueTuple should be an array with values [ key: string, value: any ]
|
|
122
|
-
*
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
*
|
|
134
|
-
*
|
|
169
|
+
* @example ```
|
|
170
|
+
|
|
171
|
+
var pairs = [ ["fookey", "fooval"], ["barkey", "barval"] ]
|
|
172
|
+
|
|
173
|
+
var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {})
|
|
174
|
+
// pairsToObj == { fookey: "fooval", barkey: "barval" }
|
|
175
|
+
|
|
176
|
+
// Or, more simply:
|
|
177
|
+
var pairsToObj = pairs.reduce(applyPairs, {})
|
|
178
|
+
// pairsToObj == { fookey: "fooval", barkey: "barval" }
|
|
179
|
+
```
|
|
180
|
+
* @param {{ [x: string]: any; }} memo
|
|
181
|
+
* @param {any[]} keyValTuple
|
|
135
182
|
*/
|
|
136
|
-
export function applyPairs(
|
|
183
|
+
export function applyPairs(
|
|
184
|
+
memo: {
|
|
185
|
+
[x: string]: any;
|
|
186
|
+
},
|
|
187
|
+
keyValTuple: any[],
|
|
188
|
+
): {
|
|
189
|
+
[x: string]: any;
|
|
190
|
+
};
|
|
137
191
|
/**
|
|
138
192
|
* Returns the last element of an array, or undefined if the array is empty.
|
|
139
193
|
* @template T
|
|
@@ -143,15 +197,22 @@ export function applyPairs(memo: any, keyValTuple: any): any;
|
|
|
143
197
|
export function tail<T>(arr: any[] | string): T | undefined;
|
|
144
198
|
/**
|
|
145
199
|
* shallow copy from src to dest
|
|
200
|
+
* @param {any} src
|
|
201
|
+
* @param {any} dest
|
|
146
202
|
*/
|
|
147
203
|
export function copy(src: any, dest: any): any;
|
|
148
204
|
export function allTrueR(memo: any, elem: any): any;
|
|
149
205
|
export function anyTrueR(memo: any, elem: any): any;
|
|
150
|
-
export function unnestR(memo:
|
|
151
|
-
export function flattenR(memo:
|
|
152
|
-
export function uniqR(acc: any, token: any): any;
|
|
153
|
-
export function unnest(arr: any): any;
|
|
206
|
+
export function unnestR<T>(memo: T[], elem: T | T[]): T[];
|
|
207
|
+
export function flattenR<T>(memo: T[], elem: any): T[];
|
|
208
|
+
export function uniqR(acc: any[], token: any): any[];
|
|
209
|
+
export function unnest(arr: any[]): any;
|
|
210
|
+
/**
|
|
211
|
+
* @param {(arg0: any) => any} predicateOrMap
|
|
212
|
+
* @param {string} errMsg
|
|
213
|
+
* @return {(obj:any) => any}
|
|
214
|
+
*/
|
|
154
215
|
export function assertPredicate(
|
|
155
|
-
predicateOrMap: any,
|
|
216
|
+
predicateOrMap: (arg0: any) => any,
|
|
156
217
|
errMsg?: string,
|
|
157
218
|
): (obj: any) => any;
|
package/@types/shared/node.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export type NodeType = number;
|
|
2
2
|
export namespace NodeType {
|
|
3
|
-
let _ELEMENT_NODE:
|
|
4
|
-
let _DOCUMENT_NODE:
|
|
5
|
-
let _TEXT_NODE:
|
|
6
|
-
let _COMMENT_NODE:
|
|
7
|
-
let _DOCUMENT_FRAGMENT_NODE:
|
|
3
|
+
let _ELEMENT_NODE: number;
|
|
4
|
+
let _DOCUMENT_NODE: number;
|
|
5
|
+
let _TEXT_NODE: number;
|
|
6
|
+
let _COMMENT_NODE: number;
|
|
7
|
+
let _DOCUMENT_FRAGMENT_NODE: number;
|
|
8
8
|
}
|
|
@@ -64,8 +64,8 @@ export function splitOnDelim(
|
|
|
64
64
|
* let arr = ["foo", "bar", 1, "baz", "", "qux" ];
|
|
65
65
|
* arr.reduce(joinNeighborsR, []) // ["foobar", 1, "bazqux" ]
|
|
66
66
|
* ```
|
|
67
|
-
* @param {
|
|
67
|
+
* @param {any[]} acc
|
|
68
68
|
* @param {unknown} str
|
|
69
69
|
*/
|
|
70
|
-
export function joinNeighborsR(acc:
|
|
70
|
+
export function joinNeighborsR(acc: any[], str: unknown): any[];
|
|
71
71
|
export function stripLastPathElement(str: string): string;
|