@alterior/common 3.13.3 → 3.13.4
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/dist/base64.d.ts +6 -6
- package/dist/base64.js +52 -52
- package/dist/base64.js.map +1 -1
- package/dist/base64.test.d.ts +1 -1
- package/dist/cache.d.ts +84 -84
- package/dist/cache.js +148 -148
- package/dist/cache.js.map +1 -1
- package/dist/cache.test.d.ts +1 -1
- package/dist/check-native-async.d.ts +1 -1
- package/dist/check-native-async.js +27 -28
- package/dist/check-native-async.js.map +1 -1
- package/dist/clone.d.ts +23 -23
- package/dist/clone.js +59 -60
- package/dist/clone.js.map +1 -1
- package/dist/clone.test.d.ts +1 -1
- package/dist/coalesce.d.ts +5 -5
- package/dist/coalesce.js +15 -16
- package/dist/coalesce.js.map +1 -1
- package/dist/coalesce.test.d.ts +1 -1
- package/dist/colors.d.ts +62 -62
- package/dist/colors.js +66 -66
- package/dist/console.d.ts +31 -31
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +65 -86
- package/dist/console.js.map +1 -1
- package/dist/constructor.d.ts +6 -6
- package/dist/constructor.js +2 -2
- package/dist/decorators.d.ts +1 -1
- package/dist/decorators.d.ts.map +1 -1
- package/dist/decorators.js +6 -7
- package/dist/decorators.js.map +1 -1
- package/dist/environment.d.ts +11 -11
- package/dist/environment.d.ts.map +1 -1
- package/dist/environment.js +27 -27
- package/dist/environment.js.map +1 -1
- package/dist/errors.d.ts +66 -66
- package/dist/errors.js +133 -133
- package/dist/errors.test.d.ts +1 -1
- package/dist/get-param-names.d.ts +5 -5
- package/dist/get-param-names.js +48 -49
- package/dist/get-param-names.js.map +1 -1
- package/dist/index.d.ts +20 -20
- package/dist/index.js +23 -23
- package/dist/is-constructor.d.ts +12 -12
- package/dist/is-constructor.js +28 -29
- package/dist/is-constructor.js.map +1 -1
- package/dist/is-constructor.test.d.ts +1 -1
- package/dist/lazy-promise.d.ts +14 -14
- package/dist/lazy-promise.js +32 -32
- package/dist/lazy-promise.js.map +1 -1
- package/dist/lazy-subject.d.ts +22 -22
- package/dist/lazy-subject.js +22 -23
- package/dist/lazy-subject.js.map +1 -1
- package/dist/locks.d.ts +23 -23
- package/dist/locks.js +76 -76
- package/dist/locks.js.map +1 -1
- package/dist/locks.test.d.ts +1 -1
- package/dist/locks.test.js.map +1 -1
- package/dist/padding.d.ts +22 -22
- package/dist/padding.js +42 -43
- package/dist/padding.js.map +1 -1
- package/dist/presentation.d.ts +49 -49
- package/dist/presentation.d.ts.map +1 -1
- package/dist/presentation.js +132 -132
- package/dist/presentation.js.map +1 -1
- package/dist/presentation.test.d.ts +1 -1
- package/dist/presentation.test.js.map +1 -1
- package/dist/serializer.d.ts +8 -8
- package/dist/serializer.js +23 -24
- package/dist/serializer.js.map +1 -1
- package/dist/test.d.ts +2 -2
- package/dist/time.d.ts +9 -9
- package/dist/time.js +22 -22
- package/dist/time.js.map +1 -1
- package/dist/timeout.d.ts +13 -13
- package/dist/timeout.js +27 -28
- package/dist/timeout.js.map +1 -1
- package/dist/zones.d.ts +46 -46
- package/dist/zones.js +139 -139
- package/dist/zones.js.map +1 -1
- package/dist.esm/base64.d.ts +6 -6
- package/dist.esm/base64.js +48 -48
- package/dist.esm/base64.js.map +1 -1
- package/dist.esm/base64.test.d.ts +1 -1
- package/dist.esm/cache.d.ts +84 -84
- package/dist.esm/cache.js +144 -144
- package/dist.esm/cache.js.map +1 -1
- package/dist.esm/cache.test.d.ts +1 -1
- package/dist.esm/check-native-async.d.ts +1 -1
- package/dist.esm/check-native-async.js +24 -24
- package/dist.esm/check-native-async.js.map +1 -1
- package/dist.esm/clone.d.ts +23 -23
- package/dist.esm/clone.js +53 -53
- package/dist.esm/clone.js.map +1 -1
- package/dist.esm/clone.test.d.ts +1 -1
- package/dist.esm/coalesce.d.ts +5 -5
- package/dist.esm/coalesce.js +12 -12
- package/dist.esm/coalesce.js.map +1 -1
- package/dist.esm/coalesce.test.d.ts +1 -1
- package/dist.esm/colors.d.ts +62 -62
- package/dist.esm/colors.js +63 -63
- package/dist.esm/console.d.ts +31 -31
- package/dist.esm/console.d.ts.map +1 -1
- package/dist.esm/console.js +60 -80
- package/dist.esm/console.js.map +1 -1
- package/dist.esm/constructor.d.ts +6 -6
- package/dist.esm/constructor.js +1 -1
- package/dist.esm/decorators.d.ts +1 -1
- package/dist.esm/decorators.d.ts.map +1 -1
- package/dist.esm/decorators.js +3 -3
- package/dist.esm/environment.d.ts +11 -11
- package/dist.esm/environment.d.ts.map +1 -1
- package/dist.esm/environment.js +24 -24
- package/dist.esm/environment.js.map +1 -1
- package/dist.esm/errors.d.ts +66 -66
- package/dist.esm/errors.js +115 -115
- package/dist.esm/errors.test.d.ts +1 -1
- package/dist.esm/get-param-names.d.ts +5 -5
- package/dist.esm/get-param-names.js +45 -45
- package/dist.esm/get-param-names.js.map +1 -1
- package/dist.esm/index.d.ts +20 -20
- package/dist.esm/index.js +20 -20
- package/dist.esm/is-constructor.d.ts +12 -12
- package/dist.esm/is-constructor.js +24 -24
- package/dist.esm/is-constructor.js.map +1 -1
- package/dist.esm/is-constructor.test.d.ts +1 -1
- package/dist.esm/lazy-promise.d.ts +14 -14
- package/dist.esm/lazy-promise.js +28 -28
- package/dist.esm/lazy-promise.js.map +1 -1
- package/dist.esm/lazy-subject.d.ts +22 -22
- package/dist.esm/lazy-subject.js +19 -19
- package/dist.esm/locks.d.ts +23 -23
- package/dist.esm/locks.js +71 -71
- package/dist.esm/locks.js.map +1 -1
- package/dist.esm/locks.test.d.ts +1 -1
- package/dist.esm/locks.test.js.map +1 -1
- package/dist.esm/padding.d.ts +22 -22
- package/dist.esm/padding.js +37 -37
- package/dist.esm/presentation.d.ts +49 -49
- package/dist.esm/presentation.d.ts.map +1 -1
- package/dist.esm/presentation.js +126 -126
- package/dist.esm/presentation.js.map +1 -1
- package/dist.esm/presentation.test.d.ts +1 -1
- package/dist.esm/presentation.test.js.map +1 -1
- package/dist.esm/serializer.d.ts +8 -8
- package/dist.esm/serializer.js +20 -20
- package/dist.esm/test.d.ts +2 -2
- package/dist.esm/time.d.ts +9 -9
- package/dist.esm/time.js +19 -19
- package/dist.esm/time.js.map +1 -1
- package/dist.esm/timeout.d.ts +13 -13
- package/dist.esm/timeout.js +23 -23
- package/dist.esm/tsconfig.esm.tsbuildinfo +1 -0
- package/dist.esm/zones.d.ts +46 -46
- package/dist.esm/zones.js +135 -135
- package/dist.esm/zones.js.map +1 -1
- package/package.json +10 -7
- package/src/console.ts +2 -22
- package/src/environment.ts +2 -0
- package/tsconfig.esm.json +0 -3
- package/tsconfig.json +0 -2
- package/tsconfig.tsbuildinfo +1 -3791
package/dist/errors.js
CHANGED
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpError = exports.AccessDeniedError = exports.InvalidOperationError = exports.FormatError = exports.IOError = exports.TimeoutError = exports.OperationCanceledError = exports.NotImplementedError = exports.NotSupportedError = exports.ArgumentOutOfRangeError = exports.ArgumentNullError = exports.ArgumentError = exports.ApplicationError = exports.SystemError = exports.BaseError = void 0;
|
|
4
|
-
class BaseError extends Error {
|
|
5
|
-
constructor(message, options) {
|
|
6
|
-
super(message, options);
|
|
7
|
-
}
|
|
8
|
-
static setJSONSerializer(serializer) {
|
|
9
|
-
this.serializer = serializer;
|
|
10
|
-
}
|
|
11
|
-
asJSON() {
|
|
12
|
-
if (BaseError.serializer)
|
|
13
|
-
return BaseError.serializer(this);
|
|
14
|
-
let ownKeys = Object.getOwnPropertyNames(this);
|
|
15
|
-
let repr = {
|
|
16
|
-
$type: this.constructor.name,
|
|
17
|
-
error: true,
|
|
18
|
-
message: this.message,
|
|
19
|
-
stack: this['stack']
|
|
20
|
-
};
|
|
21
|
-
let includedData = ownKeys
|
|
22
|
-
.filter(x => !x.startsWith('_'))
|
|
23
|
-
.filter(x => typeof this[x] !== 'function')
|
|
24
|
-
.map(x => [x, this[x]])
|
|
25
|
-
.reduce((pv, cv) => pv[cv[0]] = cv[1], {});
|
|
26
|
-
return Object.assign({}, repr, includedData);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.BaseError = BaseError;
|
|
30
|
-
/**
|
|
31
|
-
* Base class for errors thrown by the system or framework
|
|
32
|
-
*/
|
|
33
|
-
class SystemError extends BaseError {
|
|
34
|
-
}
|
|
35
|
-
exports.SystemError = SystemError;
|
|
36
|
-
/**
|
|
37
|
-
* Base class for errors thrown by your application
|
|
38
|
-
*/
|
|
39
|
-
class ApplicationError extends BaseError {
|
|
40
|
-
}
|
|
41
|
-
exports.ApplicationError = ApplicationError;
|
|
42
|
-
class ArgumentError extends SystemError {
|
|
43
|
-
constructor(argumentName, message) {
|
|
44
|
-
super(message || `Invalid value for argument ${argumentName}`);
|
|
45
|
-
this._argumentName = argumentName;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* The invalid value passed for the given argument
|
|
49
|
-
*/
|
|
50
|
-
get value() {
|
|
51
|
-
return this._value;
|
|
52
|
-
}
|
|
53
|
-
withValue(value) {
|
|
54
|
-
this._value = value;
|
|
55
|
-
return this;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* The name of the argument
|
|
59
|
-
*/
|
|
60
|
-
get argumentName() {
|
|
61
|
-
return this._argumentName;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.ArgumentError = ArgumentError;
|
|
65
|
-
class ArgumentNullError extends ArgumentError {
|
|
66
|
-
constructor(argumentName, message) {
|
|
67
|
-
super(argumentName, message || `Argument ${argumentName} cannot be null`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.ArgumentNullError = ArgumentNullError;
|
|
71
|
-
class ArgumentOutOfRangeError extends ArgumentError {
|
|
72
|
-
constructor(argumentName, message) {
|
|
73
|
-
super(argumentName, message || `Argument ${argumentName} is out of range`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.ArgumentOutOfRangeError = ArgumentOutOfRangeError;
|
|
77
|
-
class NotSupportedError extends SystemError {
|
|
78
|
-
constructor(message) {
|
|
79
|
-
super(message || `The requested operation is not supported.`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
exports.NotSupportedError = NotSupportedError;
|
|
83
|
-
class NotImplementedError extends SystemError {
|
|
84
|
-
constructor(message) {
|
|
85
|
-
super(message || `The requested operation is not implemented.`);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
exports.NotImplementedError = NotImplementedError;
|
|
89
|
-
class OperationCanceledError extends SystemError {
|
|
90
|
-
constructor(message) {
|
|
91
|
-
super(message || `The requested operation is not implemented.`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
exports.OperationCanceledError = OperationCanceledError;
|
|
95
|
-
class TimeoutError extends SystemError {
|
|
96
|
-
constructor(message) {
|
|
97
|
-
super(message || `The operation has timed out.`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
exports.TimeoutError = TimeoutError;
|
|
101
|
-
class IOError extends SystemError {
|
|
102
|
-
constructor(message) {
|
|
103
|
-
super(message || `An I/O error has occurred.`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
exports.IOError = IOError;
|
|
107
|
-
class FormatError extends SystemError {
|
|
108
|
-
constructor(message) {
|
|
109
|
-
super(message || `Invalid format.`);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
exports.FormatError = FormatError;
|
|
113
|
-
class InvalidOperationError extends SystemError {
|
|
114
|
-
constructor(message) {
|
|
115
|
-
super(message || `Invalid format.`);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
exports.InvalidOperationError = InvalidOperationError;
|
|
119
|
-
class AccessDeniedError extends SystemError {
|
|
120
|
-
constructor(message) {
|
|
121
|
-
super(message || `Invalid format.`);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
exports.AccessDeniedError = AccessDeniedError;
|
|
125
|
-
class HttpError extends Error {
|
|
126
|
-
constructor(statusCode, body, headers = []) {
|
|
127
|
-
super(`HttpError statusCode=${statusCode} [are you sure you meant to catch this?]`);
|
|
128
|
-
this.statusCode = statusCode;
|
|
129
|
-
this.body = body;
|
|
130
|
-
this.headers = headers;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
exports.HttpError = HttpError;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpError = exports.AccessDeniedError = exports.InvalidOperationError = exports.FormatError = exports.IOError = exports.TimeoutError = exports.OperationCanceledError = exports.NotImplementedError = exports.NotSupportedError = exports.ArgumentOutOfRangeError = exports.ArgumentNullError = exports.ArgumentError = exports.ApplicationError = exports.SystemError = exports.BaseError = void 0;
|
|
4
|
+
class BaseError extends Error {
|
|
5
|
+
constructor(message, options) {
|
|
6
|
+
super(message, options);
|
|
7
|
+
}
|
|
8
|
+
static setJSONSerializer(serializer) {
|
|
9
|
+
this.serializer = serializer;
|
|
10
|
+
}
|
|
11
|
+
asJSON() {
|
|
12
|
+
if (BaseError.serializer)
|
|
13
|
+
return BaseError.serializer(this);
|
|
14
|
+
let ownKeys = Object.getOwnPropertyNames(this);
|
|
15
|
+
let repr = {
|
|
16
|
+
$type: this.constructor.name,
|
|
17
|
+
error: true,
|
|
18
|
+
message: this.message,
|
|
19
|
+
stack: this['stack']
|
|
20
|
+
};
|
|
21
|
+
let includedData = ownKeys
|
|
22
|
+
.filter(x => !x.startsWith('_'))
|
|
23
|
+
.filter(x => typeof this[x] !== 'function')
|
|
24
|
+
.map(x => [x, this[x]])
|
|
25
|
+
.reduce((pv, cv) => pv[cv[0]] = cv[1], {});
|
|
26
|
+
return Object.assign({}, repr, includedData);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.BaseError = BaseError;
|
|
30
|
+
/**
|
|
31
|
+
* Base class for errors thrown by the system or framework
|
|
32
|
+
*/
|
|
33
|
+
class SystemError extends BaseError {
|
|
34
|
+
}
|
|
35
|
+
exports.SystemError = SystemError;
|
|
36
|
+
/**
|
|
37
|
+
* Base class for errors thrown by your application
|
|
38
|
+
*/
|
|
39
|
+
class ApplicationError extends BaseError {
|
|
40
|
+
}
|
|
41
|
+
exports.ApplicationError = ApplicationError;
|
|
42
|
+
class ArgumentError extends SystemError {
|
|
43
|
+
constructor(argumentName, message) {
|
|
44
|
+
super(message || `Invalid value for argument ${argumentName}`);
|
|
45
|
+
this._argumentName = argumentName;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The invalid value passed for the given argument
|
|
49
|
+
*/
|
|
50
|
+
get value() {
|
|
51
|
+
return this._value;
|
|
52
|
+
}
|
|
53
|
+
withValue(value) {
|
|
54
|
+
this._value = value;
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The name of the argument
|
|
59
|
+
*/
|
|
60
|
+
get argumentName() {
|
|
61
|
+
return this._argumentName;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.ArgumentError = ArgumentError;
|
|
65
|
+
class ArgumentNullError extends ArgumentError {
|
|
66
|
+
constructor(argumentName, message) {
|
|
67
|
+
super(argumentName, message || `Argument ${argumentName} cannot be null`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.ArgumentNullError = ArgumentNullError;
|
|
71
|
+
class ArgumentOutOfRangeError extends ArgumentError {
|
|
72
|
+
constructor(argumentName, message) {
|
|
73
|
+
super(argumentName, message || `Argument ${argumentName} is out of range`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.ArgumentOutOfRangeError = ArgumentOutOfRangeError;
|
|
77
|
+
class NotSupportedError extends SystemError {
|
|
78
|
+
constructor(message) {
|
|
79
|
+
super(message || `The requested operation is not supported.`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.NotSupportedError = NotSupportedError;
|
|
83
|
+
class NotImplementedError extends SystemError {
|
|
84
|
+
constructor(message) {
|
|
85
|
+
super(message || `The requested operation is not implemented.`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.NotImplementedError = NotImplementedError;
|
|
89
|
+
class OperationCanceledError extends SystemError {
|
|
90
|
+
constructor(message) {
|
|
91
|
+
super(message || `The requested operation is not implemented.`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.OperationCanceledError = OperationCanceledError;
|
|
95
|
+
class TimeoutError extends SystemError {
|
|
96
|
+
constructor(message) {
|
|
97
|
+
super(message || `The operation has timed out.`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.TimeoutError = TimeoutError;
|
|
101
|
+
class IOError extends SystemError {
|
|
102
|
+
constructor(message) {
|
|
103
|
+
super(message || `An I/O error has occurred.`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.IOError = IOError;
|
|
107
|
+
class FormatError extends SystemError {
|
|
108
|
+
constructor(message) {
|
|
109
|
+
super(message || `Invalid format.`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.FormatError = FormatError;
|
|
113
|
+
class InvalidOperationError extends SystemError {
|
|
114
|
+
constructor(message) {
|
|
115
|
+
super(message || `Invalid format.`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.InvalidOperationError = InvalidOperationError;
|
|
119
|
+
class AccessDeniedError extends SystemError {
|
|
120
|
+
constructor(message) {
|
|
121
|
+
super(message || `Invalid format.`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.AccessDeniedError = AccessDeniedError;
|
|
125
|
+
class HttpError extends Error {
|
|
126
|
+
constructor(statusCode, body, headers = []) {
|
|
127
|
+
super(`HttpError statusCode=${statusCode} [are you sure you meant to catch this?]`);
|
|
128
|
+
this.statusCode = statusCode;
|
|
129
|
+
this.body = body;
|
|
130
|
+
this.headers = headers;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.HttpError = HttpError;
|
|
134
134
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.test.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=errors.test.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the names of the parameters of the given function.
|
|
3
|
-
* @param fn
|
|
4
|
-
*/
|
|
5
|
-
export declare function getParameterNames(fn: Function): string[];
|
|
1
|
+
/**
|
|
2
|
+
* Get the names of the parameters of the given function.
|
|
3
|
+
* @param fn
|
|
4
|
+
*/
|
|
5
|
+
export declare function getParameterNames(fn: Function): string[];
|
|
6
6
|
//# sourceMappingURL=get-param-names.d.ts.map
|
package/dist/get-param-names.js
CHANGED
|
@@ -1,50 +1,49 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Originally from https://github.com/goatslacker/get-parameter-names
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getParameterNames =
|
|
5
|
-
/**
|
|
6
|
-
* @hidden
|
|
7
|
-
*/
|
|
8
|
-
let COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
|
|
9
|
-
/**
|
|
10
|
-
* @hidden
|
|
11
|
-
*/
|
|
12
|
-
let DEFAULT_PARAMS = /=[^,)]+/mg;
|
|
13
|
-
/**
|
|
14
|
-
* @hidden
|
|
15
|
-
*/
|
|
16
|
-
let FAT_ARROWS = /=>.*$/mg;
|
|
17
|
-
/**
|
|
18
|
-
* @hidden
|
|
19
|
-
*/
|
|
20
|
-
let SPACES = /\s/mg;
|
|
21
|
-
/**
|
|
22
|
-
* @hidden
|
|
23
|
-
*/
|
|
24
|
-
let BEFORE_OPENING_PAREN = /^[^(]*\(/mg;
|
|
25
|
-
/**
|
|
26
|
-
* @hidden
|
|
27
|
-
*/
|
|
28
|
-
let AFTER_CLOSING_PAREN = /^([^)]*)\).*$/mg;
|
|
29
|
-
/**
|
|
30
|
-
* Get the names of the parameters of the given function.
|
|
31
|
-
* @param fn
|
|
32
|
-
*/
|
|
33
|
-
function getParameterNames(fn) {
|
|
34
|
-
// Sometimes the user may want to transform or replace a function, which may cause us to lose access to
|
|
35
|
-
// the parameter names. To provide an escape hatch for that use case, we'll check if the given function
|
|
36
|
-
// has been annotated with parameter names already.
|
|
37
|
-
if ('__parameterNames' in fn) {
|
|
38
|
-
return fn['__parameterNames'];
|
|
39
|
-
}
|
|
40
|
-
let code = fn.toString()
|
|
41
|
-
.replace(SPACES, '')
|
|
42
|
-
.replace(COMMENTS, '')
|
|
43
|
-
.replace(FAT_ARROWS, '')
|
|
44
|
-
.replace(DEFAULT_PARAMS, '')
|
|
45
|
-
.replace(BEFORE_OPENING_PAREN, '')
|
|
46
|
-
.replace(AFTER_CLOSING_PAREN, '$1');
|
|
47
|
-
return code ? code.split(',') : [];
|
|
48
|
-
}
|
|
49
|
-
exports.getParameterNames = getParameterNames;
|
|
1
|
+
"use strict";
|
|
2
|
+
// Originally from https://github.com/goatslacker/get-parameter-names
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getParameterNames = getParameterNames;
|
|
5
|
+
/**
|
|
6
|
+
* @hidden
|
|
7
|
+
*/
|
|
8
|
+
let COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
let DEFAULT_PARAMS = /=[^,)]+/mg;
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
let FAT_ARROWS = /=>.*$/mg;
|
|
17
|
+
/**
|
|
18
|
+
* @hidden
|
|
19
|
+
*/
|
|
20
|
+
let SPACES = /\s/mg;
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
let BEFORE_OPENING_PAREN = /^[^(]*\(/mg;
|
|
25
|
+
/**
|
|
26
|
+
* @hidden
|
|
27
|
+
*/
|
|
28
|
+
let AFTER_CLOSING_PAREN = /^([^)]*)\).*$/mg;
|
|
29
|
+
/**
|
|
30
|
+
* Get the names of the parameters of the given function.
|
|
31
|
+
* @param fn
|
|
32
|
+
*/
|
|
33
|
+
function getParameterNames(fn) {
|
|
34
|
+
// Sometimes the user may want to transform or replace a function, which may cause us to lose access to
|
|
35
|
+
// the parameter names. To provide an escape hatch for that use case, we'll check if the given function
|
|
36
|
+
// has been annotated with parameter names already.
|
|
37
|
+
if ('__parameterNames' in fn) {
|
|
38
|
+
return fn['__parameterNames'];
|
|
39
|
+
}
|
|
40
|
+
let code = fn.toString()
|
|
41
|
+
.replace(SPACES, '')
|
|
42
|
+
.replace(COMMENTS, '')
|
|
43
|
+
.replace(FAT_ARROWS, '')
|
|
44
|
+
.replace(DEFAULT_PARAMS, '')
|
|
45
|
+
.replace(BEFORE_OPENING_PAREN, '')
|
|
46
|
+
.replace(AFTER_CLOSING_PAREN, '$1');
|
|
47
|
+
return code ? code.split(',') : [];
|
|
48
|
+
}
|
|
50
49
|
//# sourceMappingURL=get-param-names.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-param-names.js","sourceRoot":"","sources":["../src/get-param-names.ts"],"names":[],"mappings":";AAAA,qEAAqE
|
|
1
|
+
{"version":3,"file":"get-param-names.js","sourceRoot":"","sources":["../src/get-param-names.ts"],"names":[],"mappings":";AAAA,qEAAqE;;AA+BrE,8CAmBC;AAhDD;;GAEG;AACH,IAAI,QAAQ,GAAG,kCAAkC,CAAC;AAClD;;GAEG;AACH,IAAI,cAAc,GAAG,WAAW,CAAC;AACjC;;GAEG;AACH,IAAI,UAAU,GAAG,SAAS,CAAC;AAC3B;;GAEG;AACH,IAAI,MAAM,GAAG,MAAM,CAAC;AACpB;;GAEG;AACH,IAAI,oBAAoB,GAAG,YAAY,CAAC;AACtC;;GAEG;AACL,IAAI,mBAAmB,GAAG,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,EAAY;IAE5C,wGAAwG;IACxG,uGAAuG;IACvG,mDAAmD;IAEnD,IAAI,kBAAkB,IAAI,EAAE,EAAE,CAAC;QAC7B,OAAO,EAAE,CAAC,kBAAkB,CAAa,CAAC;IAC5C,CAAC;IAED,IAAI,IAAI,GAAG,EAAE,CAAC,QAAQ,EAAE;SACrB,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;SACnB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;SAC3B,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC;SACjC,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;IAEtC,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export * from './zones';
|
|
2
|
-
export * from './clone';
|
|
3
|
-
export * from './coalesce';
|
|
4
|
-
export * from './colors';
|
|
5
|
-
export * from './console';
|
|
6
|
-
export * from './environment';
|
|
7
|
-
export * from './errors';
|
|
8
|
-
export * from './timeout';
|
|
9
|
-
export * from './base64';
|
|
10
|
-
export * from './cache';
|
|
11
|
-
export * from './serializer';
|
|
12
|
-
export * from './lazy-promise';
|
|
13
|
-
export * from './locks';
|
|
14
|
-
export * from './presentation';
|
|
15
|
-
export * from './time';
|
|
16
|
-
export * from './get-param-names';
|
|
17
|
-
export * from './lazy-subject';
|
|
18
|
-
export * from './check-native-async';
|
|
19
|
-
export * from './is-constructor';
|
|
20
|
-
export * from './padding';
|
|
1
|
+
export * from './zones';
|
|
2
|
+
export * from './clone';
|
|
3
|
+
export * from './coalesce';
|
|
4
|
+
export * from './colors';
|
|
5
|
+
export * from './console';
|
|
6
|
+
export * from './environment';
|
|
7
|
+
export * from './errors';
|
|
8
|
+
export * from './timeout';
|
|
9
|
+
export * from './base64';
|
|
10
|
+
export * from './cache';
|
|
11
|
+
export * from './serializer';
|
|
12
|
+
export * from './lazy-promise';
|
|
13
|
+
export * from './locks';
|
|
14
|
+
export * from './presentation';
|
|
15
|
+
export * from './time';
|
|
16
|
+
export * from './get-param-names';
|
|
17
|
+
export * from './lazy-subject';
|
|
18
|
+
export * from './check-native-async';
|
|
19
|
+
export * from './is-constructor';
|
|
20
|
+
export * from './padding';
|
|
21
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./zones"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./clone"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./coalesce"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./colors"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./console"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./environment"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./errors"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./timeout"), exports);
|
|
12
|
-
tslib_1.__exportStar(require("./base64"), exports);
|
|
13
|
-
tslib_1.__exportStar(require("./cache"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./serializer"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./lazy-promise"), exports);
|
|
16
|
-
tslib_1.__exportStar(require("./locks"), exports);
|
|
17
|
-
tslib_1.__exportStar(require("./presentation"), exports);
|
|
18
|
-
tslib_1.__exportStar(require("./time"), exports);
|
|
19
|
-
tslib_1.__exportStar(require("./get-param-names"), exports);
|
|
20
|
-
tslib_1.__exportStar(require("./lazy-subject"), exports);
|
|
21
|
-
tslib_1.__exportStar(require("./check-native-async"), exports);
|
|
22
|
-
tslib_1.__exportStar(require("./is-constructor"), exports);
|
|
23
|
-
tslib_1.__exportStar(require("./padding"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./zones"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./clone"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./coalesce"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./colors"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./console"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./environment"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./errors"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./timeout"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./base64"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./cache"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./serializer"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./lazy-promise"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./locks"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./presentation"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./time"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./get-param-names"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./lazy-subject"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./check-native-async"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./is-constructor"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./padding"), exports);
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
package/dist/is-constructor.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Check if the given function is constructable. Note that this is not the same as a *class*. In Ecmascript, normal
|
|
3
|
-
* functions are also constructable. Use isClass() if you want to check if a function is a class.
|
|
4
|
-
*
|
|
5
|
-
* @see https://stackoverflow.com/a/46759625
|
|
6
|
-
*/
|
|
7
|
-
export declare function isConstructor(f: Function): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Check if the given function is a class. Note that this only works for Ecmascript standard classes, the older
|
|
10
|
-
* prototype style constructor functions will return false here.
|
|
11
|
-
*/
|
|
12
|
-
export declare function isClass(f: Function): boolean;
|
|
1
|
+
/**
|
|
2
|
+
* Check if the given function is constructable. Note that this is not the same as a *class*. In Ecmascript, normal
|
|
3
|
+
* functions are also constructable. Use isClass() if you want to check if a function is a class.
|
|
4
|
+
*
|
|
5
|
+
* @see https://stackoverflow.com/a/46759625
|
|
6
|
+
*/
|
|
7
|
+
export declare function isConstructor(f: Function): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Check if the given function is a class. Note that this only works for Ecmascript standard classes, the older
|
|
10
|
+
* prototype style constructor functions will return false here.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isClass(f: Function): boolean;
|
|
13
13
|
//# sourceMappingURL=is-constructor.d.ts.map
|
package/dist/is-constructor.js
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Check if the given function is a class. Note that this only works for Ecmascript standard classes, the older
|
|
24
|
-
* prototype style constructor functions will return false here.
|
|
25
|
-
*/
|
|
26
|
-
function isClass(f) {
|
|
27
|
-
return f.toString().startsWith('class ');
|
|
28
|
-
}
|
|
29
|
-
exports.isClass = isClass;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isConstructor = isConstructor;
|
|
4
|
+
exports.isClass = isClass;
|
|
5
|
+
/**
|
|
6
|
+
* Check if the given function is constructable. Note that this is not the same as a *class*. In Ecmascript, normal
|
|
7
|
+
* functions are also constructable. Use isClass() if you want to check if a function is a class.
|
|
8
|
+
*
|
|
9
|
+
* @see https://stackoverflow.com/a/46759625
|
|
10
|
+
*/
|
|
11
|
+
function isConstructor(f) {
|
|
12
|
+
if (f === Symbol)
|
|
13
|
+
return false;
|
|
14
|
+
try {
|
|
15
|
+
Reflect.construct(String, [], f);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Check if the given function is a class. Note that this only works for Ecmascript standard classes, the older
|
|
24
|
+
* prototype style constructor functions will return false here.
|
|
25
|
+
*/
|
|
26
|
+
function isClass(f) {
|
|
27
|
+
return f.toString().startsWith('class ');
|
|
28
|
+
}
|
|
30
29
|
//# sourceMappingURL=is-constructor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-constructor.js","sourceRoot":"","sources":["../src/is-constructor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-constructor.js","sourceRoot":"","sources":["../src/is-constructor.ts"],"names":[],"mappings":";;AAMA,sCAUC;AAMD,0BAEC;AAxBD;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,CAAW;IACrC,IAAI,CAAC,KAAK,MAAM;QACZ,OAAO,KAAK,CAAC;IAEjB,IAAI,CAAC;QACD,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,CAAW;IAC/B,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=is-constructor.test.d.ts.map
|
package/dist/lazy-promise.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A promise that lets you wait until someone actually requests the result of the promise to kick off
|
|
3
|
-
* the action being promised. This lets you return the promise before you start executing the async action.
|
|
4
|
-
*/
|
|
5
|
-
export declare class LazyPromise<T> extends Promise<T> {
|
|
6
|
-
private fulfiller;
|
|
7
|
-
constructor(fulfiller: () => Promise<T>);
|
|
8
|
-
private _resolve;
|
|
9
|
-
private _reject;
|
|
10
|
-
fulfill(): void;
|
|
11
|
-
private realPromise;
|
|
12
|
-
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
|
13
|
-
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
|
|
14
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* A promise that lets you wait until someone actually requests the result of the promise to kick off
|
|
3
|
+
* the action being promised. This lets you return the promise before you start executing the async action.
|
|
4
|
+
*/
|
|
5
|
+
export declare class LazyPromise<T> extends Promise<T> {
|
|
6
|
+
private fulfiller;
|
|
7
|
+
constructor(fulfiller: () => Promise<T>);
|
|
8
|
+
private _resolve;
|
|
9
|
+
private _reject;
|
|
10
|
+
fulfill(): void;
|
|
11
|
+
private realPromise;
|
|
12
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
|
13
|
+
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
|
|
14
|
+
}
|
|
15
15
|
//# sourceMappingURL=lazy-promise.d.ts.map
|