@tstdl/base 0.88.0-alpha5 → 0.88.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/package.json +2 -2
- package/schema/constraints/maximum-length.d.ts +1 -1
- package/schema/constraints/minimum-length.d.ts +1 -1
- package/schema/types/types.js +5 -6
- package/text/localization.service.js +4 -4
- package/types.d.ts +1 -1
- package/utils/merge.js +3 -3
- package/utils/object/decycle.js +2 -2
- package/utils/repl.js +1 -1
- package/utils/type-guards.d.ts +263 -243
- package/utils/type-guards.js +319 -243
- package/utils/url-builder.js +5 -3
package/utils/type-guards.js
CHANGED
|
@@ -1,253 +1,329 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/ban-types, @typescript-eslint/restrict-template-expressions, max-statements-per-line */
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-types, @typescript-eslint/restrict-template-expressions, max-statements-per-line, no-eq-null */
|
|
2
2
|
import { supportsBlob, supportsReadableStream } from '../supports.js';
|
|
3
3
|
import { AssertionError } from '../error/assertion.error.js';
|
|
4
4
|
export function assert(condition, message = 'assertion failed') {
|
|
5
5
|
if (!condition) {
|
|
6
|
-
throw new AssertionError(
|
|
6
|
+
throw new AssertionError((typeof message == 'function') ? message() : message);
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
export function assertNot(condition, message = 'assertion failed') {
|
|
10
10
|
if (condition) {
|
|
11
|
-
throw new AssertionError(
|
|
11
|
+
throw new AssertionError((typeof message == 'function') ? message() : message);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
export function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export function
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export
|
|
46
|
-
export
|
|
47
|
-
export
|
|
48
|
-
export
|
|
49
|
-
export
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
export
|
|
53
|
-
export
|
|
54
|
-
export
|
|
55
|
-
export
|
|
56
|
-
export
|
|
57
|
-
export
|
|
58
|
-
|
|
59
|
-
export
|
|
60
|
-
export
|
|
61
|
-
export
|
|
62
|
-
export
|
|
63
|
-
export
|
|
64
|
-
export
|
|
65
|
-
|
|
66
|
-
export
|
|
67
|
-
export
|
|
68
|
-
export
|
|
69
|
-
export
|
|
70
|
-
export
|
|
71
|
-
export
|
|
72
|
-
|
|
73
|
-
export
|
|
74
|
-
export
|
|
75
|
-
export
|
|
76
|
-
export
|
|
77
|
-
export
|
|
78
|
-
export
|
|
79
|
-
|
|
80
|
-
export
|
|
81
|
-
export
|
|
82
|
-
export
|
|
83
|
-
export
|
|
84
|
-
export
|
|
85
|
-
export
|
|
86
|
-
|
|
87
|
-
export
|
|
88
|
-
export
|
|
89
|
-
export
|
|
90
|
-
export
|
|
91
|
-
export
|
|
92
|
-
export
|
|
93
|
-
|
|
94
|
-
export
|
|
95
|
-
export
|
|
96
|
-
export
|
|
97
|
-
export
|
|
98
|
-
export
|
|
99
|
-
export
|
|
100
|
-
|
|
101
|
-
export
|
|
102
|
-
export
|
|
103
|
-
export
|
|
104
|
-
export
|
|
105
|
-
export
|
|
106
|
-
export
|
|
107
|
-
|
|
108
|
-
export
|
|
109
|
-
export
|
|
110
|
-
export
|
|
111
|
-
export
|
|
112
|
-
export
|
|
113
|
-
export
|
|
114
|
-
|
|
115
|
-
export
|
|
116
|
-
export
|
|
117
|
-
export
|
|
118
|
-
export
|
|
119
|
-
export
|
|
120
|
-
export
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
export
|
|
126
|
-
export
|
|
127
|
-
export
|
|
128
|
-
export
|
|
129
|
-
export
|
|
130
|
-
export
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
export
|
|
136
|
-
export
|
|
137
|
-
export
|
|
138
|
-
export
|
|
139
|
-
export
|
|
140
|
-
export
|
|
141
|
-
|
|
142
|
-
export
|
|
143
|
-
export
|
|
144
|
-
export
|
|
145
|
-
export
|
|
146
|
-
export
|
|
147
|
-
export
|
|
148
|
-
|
|
149
|
-
export
|
|
150
|
-
export
|
|
151
|
-
export
|
|
152
|
-
export
|
|
153
|
-
export
|
|
154
|
-
export
|
|
155
|
-
|
|
156
|
-
export
|
|
157
|
-
export
|
|
158
|
-
export
|
|
159
|
-
export
|
|
160
|
-
export
|
|
161
|
-
export
|
|
162
|
-
|
|
163
|
-
export
|
|
164
|
-
export
|
|
165
|
-
export
|
|
166
|
-
export
|
|
167
|
-
export
|
|
168
|
-
export
|
|
169
|
-
|
|
170
|
-
export
|
|
171
|
-
export
|
|
172
|
-
export
|
|
173
|
-
export
|
|
174
|
-
export
|
|
175
|
-
export
|
|
176
|
-
|
|
177
|
-
export
|
|
178
|
-
export
|
|
179
|
-
export
|
|
180
|
-
export
|
|
181
|
-
export
|
|
182
|
-
export
|
|
183
|
-
|
|
184
|
-
export
|
|
185
|
-
export
|
|
186
|
-
export
|
|
187
|
-
export
|
|
188
|
-
export
|
|
189
|
-
export
|
|
190
|
-
|
|
191
|
-
export
|
|
192
|
-
export
|
|
193
|
-
export
|
|
194
|
-
export
|
|
195
|
-
export
|
|
196
|
-
export
|
|
197
|
-
|
|
198
|
-
export
|
|
199
|
-
export
|
|
200
|
-
export
|
|
201
|
-
export
|
|
202
|
-
export
|
|
203
|
-
export
|
|
204
|
-
|
|
205
|
-
export
|
|
206
|
-
export
|
|
207
|
-
export
|
|
208
|
-
export
|
|
209
|
-
export
|
|
210
|
-
export
|
|
211
|
-
|
|
212
|
-
export
|
|
213
|
-
export
|
|
214
|
-
export
|
|
215
|
-
export
|
|
216
|
-
export
|
|
217
|
-
export
|
|
218
|
-
|
|
219
|
-
export
|
|
220
|
-
export
|
|
221
|
-
export
|
|
222
|
-
export
|
|
223
|
-
export
|
|
224
|
-
export
|
|
225
|
-
|
|
226
|
-
export
|
|
227
|
-
export
|
|
228
|
-
export
|
|
229
|
-
export
|
|
230
|
-
export
|
|
231
|
-
export
|
|
232
|
-
|
|
233
|
-
export
|
|
234
|
-
export
|
|
235
|
-
export
|
|
236
|
-
export
|
|
237
|
-
export
|
|
238
|
-
export
|
|
239
|
-
|
|
240
|
-
export
|
|
241
|
-
export
|
|
242
|
-
export
|
|
243
|
-
export
|
|
244
|
-
export
|
|
245
|
-
export
|
|
246
|
-
|
|
247
|
-
export
|
|
248
|
-
export
|
|
249
|
-
export
|
|
250
|
-
export
|
|
251
|
-
export
|
|
252
|
-
export
|
|
253
|
-
|
|
14
|
+
export function createGuards(name, testFn) {
|
|
15
|
+
const normalizedName = name.split(' ').map((slice) => slice[0].toUpperCase() + slice.slice(1)).join('');
|
|
16
|
+
const defaultMessage = `Expected value to be ${name}.`;
|
|
17
|
+
const defaultNotMessage = `Expected value to not be ${name}.`;
|
|
18
|
+
return {
|
|
19
|
+
[`is${normalizedName}`](value) {
|
|
20
|
+
return testFn(value);
|
|
21
|
+
},
|
|
22
|
+
[`isNot${normalizedName}`](value) {
|
|
23
|
+
return !testFn(value);
|
|
24
|
+
},
|
|
25
|
+
[`assert${normalizedName}`](value, message = defaultMessage) {
|
|
26
|
+
assert(testFn(value), message);
|
|
27
|
+
},
|
|
28
|
+
[`assertNot${normalizedName}`](value, message = defaultNotMessage) {
|
|
29
|
+
assertNot(testFn(value), message);
|
|
30
|
+
},
|
|
31
|
+
[`assert${normalizedName}Pass`](value, message = defaultMessage) {
|
|
32
|
+
assert(testFn(value), message);
|
|
33
|
+
return value;
|
|
34
|
+
},
|
|
35
|
+
[`assertNot${normalizedName}Pass`](value, message = defaultNotMessage) {
|
|
36
|
+
assertNot(testFn(value), message);
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export function createInstanceGuards(name, type) {
|
|
42
|
+
return createGuards(name, (value) => value instanceof type);
|
|
43
|
+
}
|
|
44
|
+
const undefinedGuards = createGuards('undefined', (value) => (value === undefined));
|
|
45
|
+
export const isUndefined = undefinedGuards.isUndefined;
|
|
46
|
+
export const isDefined = undefinedGuards.isNotUndefined;
|
|
47
|
+
export const assertUndefined = undefinedGuards.assertUndefined;
|
|
48
|
+
export const assertDefined = undefinedGuards.assertNotUndefined;
|
|
49
|
+
export const assertUndefinedPass = undefinedGuards.assertUndefinedPass;
|
|
50
|
+
export const assertDefinedPass = undefinedGuards.assertNotUndefinedPass;
|
|
51
|
+
const nullGuards = createGuards('null', (value) => (value === null));
|
|
52
|
+
export const isNull = nullGuards.isNull;
|
|
53
|
+
export const isNotNull = nullGuards.isNotNull;
|
|
54
|
+
export const assertNull = nullGuards.assertNull;
|
|
55
|
+
export const assertNotNull = nullGuards.assertNotNull;
|
|
56
|
+
export const assertNullPass = nullGuards.assertNullPass;
|
|
57
|
+
export const assertNotNullPass = nullGuards.assertNotNullPass;
|
|
58
|
+
const nullOrUndefinedGuards = createGuards('null or undefined', (value) => (value === null) || (value === undefined));
|
|
59
|
+
export const isNullOrUndefined = nullOrUndefinedGuards.isNullOrUndefined;
|
|
60
|
+
export const isNotNullOrUndefined = nullOrUndefinedGuards.isNotNullOrUndefined;
|
|
61
|
+
export const assertNullOrUndefined = nullOrUndefinedGuards.assertNullOrUndefined;
|
|
62
|
+
export const assertNotNullOrUndefined = nullOrUndefinedGuards.assertNotNullOrUndefined;
|
|
63
|
+
export const assertNullOrUndefinedPass = nullOrUndefinedGuards.assertNullOrUndefinedPass;
|
|
64
|
+
export const assertNotNullOrUndefinedPass = nullOrUndefinedGuards.assertNotNullOrUndefinedPass;
|
|
65
|
+
const numberGuards = createGuards('number', (value) => (typeof value == 'number'));
|
|
66
|
+
export const isNumber = numberGuards.isNumber;
|
|
67
|
+
export const isNotNumber = numberGuards.isNotNumber;
|
|
68
|
+
export const assertNumber = numberGuards.assertNumber;
|
|
69
|
+
export const assertNotNumber = numberGuards.assertNotNumber;
|
|
70
|
+
export const assertNumberPass = numberGuards.assertNumberPass;
|
|
71
|
+
export const assertNotNumberPass = numberGuards.assertNotNumberPass;
|
|
72
|
+
const stringGuards = createGuards('string', (value) => (typeof value == 'string'));
|
|
73
|
+
export const isString = stringGuards.isString;
|
|
74
|
+
export const isNotString = stringGuards.isNotString;
|
|
75
|
+
export const assertString = stringGuards.assertString;
|
|
76
|
+
export const assertNotString = stringGuards.assertNotString;
|
|
77
|
+
export const assertStringPass = stringGuards.assertStringPass;
|
|
78
|
+
export const assertNotStringPass = stringGuards.assertNotStringPass;
|
|
79
|
+
const booleanGuards = createGuards('boolean', (value) => (typeof value == 'boolean'));
|
|
80
|
+
export const isBoolean = booleanGuards.isBoolean;
|
|
81
|
+
export const isNotBoolean = booleanGuards.isNotBoolean;
|
|
82
|
+
export const assertBoolean = booleanGuards.assertBoolean;
|
|
83
|
+
export const assertNotBoolean = booleanGuards.assertNotBoolean;
|
|
84
|
+
export const assertBooleanPass = booleanGuards.assertBooleanPass;
|
|
85
|
+
export const assertNotBooleanPass = booleanGuards.assertNotBooleanPass;
|
|
86
|
+
const bigintGuards = createGuards('bigint', (value) => (typeof value == 'bigint'));
|
|
87
|
+
export const isBigInt = bigintGuards.isBigint;
|
|
88
|
+
export const isNotBigInt = bigintGuards.isNotBigint;
|
|
89
|
+
export const assertBigInt = bigintGuards.assertBigint;
|
|
90
|
+
export const assertNotBigInt = bigintGuards.assertNotBigint;
|
|
91
|
+
export const assertBigIntPass = bigintGuards.assertBigintPass;
|
|
92
|
+
export const assertNotBigIntPass = bigintGuards.assertNotBigintPass;
|
|
93
|
+
const functionGuards = createGuards('function', (value) => (typeof value == 'function'));
|
|
94
|
+
export const isFunction = functionGuards.isFunction;
|
|
95
|
+
export const isNotFunction = functionGuards.isNotFunction;
|
|
96
|
+
export const assertFunction = functionGuards.assertFunction;
|
|
97
|
+
export const assertNotFunction = functionGuards.assertNotFunction;
|
|
98
|
+
export const assertFunctionPass = functionGuards.assertFunctionPass;
|
|
99
|
+
export const assertNotFunctionPass = functionGuards.assertNotFunctionPass;
|
|
100
|
+
const symbolGuards = createGuards('symbol', (value) => (typeof value == 'symbol'));
|
|
101
|
+
export const isSymbol = symbolGuards.isSymbol;
|
|
102
|
+
export const isNotSymbol = symbolGuards.isNotSymbol;
|
|
103
|
+
export const assertSymbol = symbolGuards.assertSymbol;
|
|
104
|
+
export const assertNotSymbol = symbolGuards.assertNotSymbol;
|
|
105
|
+
export const assertSymbolPass = symbolGuards.assertSymbolPass;
|
|
106
|
+
export const assertNotSymbolPass = symbolGuards.assertNotSymbolPass;
|
|
107
|
+
const literalObjectGuards = createGuards('literal object', (value) => (typeof value == 'object') && (value != null) && (Reflect.getPrototypeOf(value) == Object.prototype) && (Reflect.getPrototypeOf(value).constructor == Object));
|
|
108
|
+
export const isLiteralObject = literalObjectGuards.isLiteralObject;
|
|
109
|
+
export const isNotLiteralObject = literalObjectGuards.isNotLiteralObject;
|
|
110
|
+
export const assertLiteralObject = literalObjectGuards.assertLiteralObject;
|
|
111
|
+
export const assertNotLiteralObject = literalObjectGuards.assertNotLiteralObject;
|
|
112
|
+
export const assertLiteralObjectPass = literalObjectGuards.assertLiteralObjectPass;
|
|
113
|
+
export const assertNotLiteralObjectPass = literalObjectGuards.assertNotLiteralObjectPass;
|
|
114
|
+
const objectGuards = createGuards('object', (value) => (typeof value == 'object') && (value != null));
|
|
115
|
+
export const isObject = objectGuards.isObject;
|
|
116
|
+
export const isNotObject = objectGuards.isNotObject;
|
|
117
|
+
export const assertObject = objectGuards.assertObject;
|
|
118
|
+
export const assertNotObject = objectGuards.assertNotObject;
|
|
119
|
+
export const assertObjectPass = objectGuards.assertObjectPass;
|
|
120
|
+
export const assertNotObjectPass = objectGuards.assertNotObjectPass;
|
|
121
|
+
const primitiveGuards = createGuards('primitive', (value) => {
|
|
122
|
+
const type = typeof value;
|
|
123
|
+
return (type == 'string') || (type == 'number') || (type == 'boolean') || (type == 'bigint') || (type == 'symbol') || (value === null) || (value === undefined);
|
|
124
|
+
});
|
|
125
|
+
export const isPrimitive = primitiveGuards.isPrimitive;
|
|
126
|
+
export const isNotPrimitive = primitiveGuards.isNotPrimitive;
|
|
127
|
+
export const assertPrimitive = primitiveGuards.assertPrimitive;
|
|
128
|
+
export const assertNotPrimitive = primitiveGuards.assertNotPrimitive;
|
|
129
|
+
export const assertPrimitivePass = primitiveGuards.assertPrimitivePass;
|
|
130
|
+
export const assertNotPrimitivePass = primitiveGuards.assertNotPrimitivePass;
|
|
131
|
+
const jsonPrimitiveGuards = createGuards('json primitive', (value) => {
|
|
132
|
+
const type = typeof value;
|
|
133
|
+
return (type == 'string') || (type == 'number') || (type == 'boolean') || (value === null);
|
|
134
|
+
});
|
|
135
|
+
export const isJsonPrimitive = jsonPrimitiveGuards.isJsonPrimitive;
|
|
136
|
+
export const isNotJsonPrimitive = jsonPrimitiveGuards.isNotJsonPrimitive;
|
|
137
|
+
export const assertJsonPrimitive = jsonPrimitiveGuards.assertJsonPrimitive;
|
|
138
|
+
export const assertNotJsonPrimitive = jsonPrimitiveGuards.assertNotJsonPrimitive;
|
|
139
|
+
export const assertJsonPrimitivePass = jsonPrimitiveGuards.assertJsonPrimitivePass;
|
|
140
|
+
export const assertNotJsonPrimitivePass = jsonPrimitiveGuards.assertNotJsonPrimitivePass;
|
|
141
|
+
const dateGuards = createInstanceGuards('date', Date);
|
|
142
|
+
export const isDate = dateGuards.isDate;
|
|
143
|
+
export const isNotDate = dateGuards.isNotDate;
|
|
144
|
+
export const assertDate = dateGuards.assertDate;
|
|
145
|
+
export const assertNotDate = dateGuards.assertNotDate;
|
|
146
|
+
export const assertDatePass = dateGuards.assertDatePass;
|
|
147
|
+
export const assertNotDatePass = dateGuards.assertNotDatePass;
|
|
148
|
+
const validDateGuards = createGuards('valid date', (value) => isDate(value) && !Number.isNaN(value.getTime()));
|
|
149
|
+
export const isValidDate = validDateGuards.isValidDate;
|
|
150
|
+
export const isNotValidDate = validDateGuards.isNotValidDate;
|
|
151
|
+
export const assertValidDate = validDateGuards.assertValidDate;
|
|
152
|
+
export const assertNotValidDate = validDateGuards.assertNotValidDate;
|
|
153
|
+
export const assertValidDatePass = validDateGuards.assertValidDatePass;
|
|
154
|
+
export const assertNotValidDatePass = validDateGuards.assertNotValidDatePass;
|
|
155
|
+
const regexpGuards = createInstanceGuards('regexp', RegExp);
|
|
156
|
+
export const isRegExp = regexpGuards.isRegexp;
|
|
157
|
+
export const isNotRegExp = regexpGuards.isNotRegexp;
|
|
158
|
+
export const assertRegExp = regexpGuards.assertRegexp;
|
|
159
|
+
export const assertNotRegExp = regexpGuards.assertNotRegexp;
|
|
160
|
+
export const assertRegExpPass = regexpGuards.assertRegexpPass;
|
|
161
|
+
export const assertNotRegExpPass = regexpGuards.assertNotRegexpPass;
|
|
162
|
+
const arrayGuards = createGuards('array', (value) => Array.isArray(value));
|
|
163
|
+
export const isArray = arrayGuards.isArray;
|
|
164
|
+
export const isNotArray = arrayGuards.isNotArray;
|
|
165
|
+
export const assertArray = arrayGuards.assertArray;
|
|
166
|
+
export const assertNotArray = arrayGuards.assertNotArray;
|
|
167
|
+
export const assertArrayPass = arrayGuards.assertArrayPass;
|
|
168
|
+
export const assertNotArrayPass = arrayGuards.assertNotArrayPass;
|
|
169
|
+
const writableArrayGuards = createGuards('writable array', (value) => Array.isArray(value));
|
|
170
|
+
export const isWritableArray = writableArrayGuards.isWritableArray;
|
|
171
|
+
export const isNotWritableArray = writableArrayGuards.isNotWritableArray;
|
|
172
|
+
export const assertWritableArray = writableArrayGuards.assertWritableArray;
|
|
173
|
+
export const assertNotWritableArray = writableArrayGuards.assertNotWritableArray;
|
|
174
|
+
export const assertWritableArrayPass = writableArrayGuards.assertWritableArrayPass;
|
|
175
|
+
export const assertNotWritableArrayPass = writableArrayGuards.assertNotWritableArrayPass;
|
|
176
|
+
const blobGuards = createGuards('Blob', (value) => (supportsBlob && (value instanceof Blob)));
|
|
177
|
+
export const isBlob = blobGuards.isBlob;
|
|
178
|
+
export const isNotBlob = blobGuards.isNotBlob;
|
|
179
|
+
export const assertBlob = blobGuards.assertBlob;
|
|
180
|
+
export const assertNotBlob = blobGuards.assertNotBlob;
|
|
181
|
+
export const assertBlobPass = blobGuards.assertBlobPass;
|
|
182
|
+
export const assertNotBlobPass = blobGuards.assertNotBlobPass;
|
|
183
|
+
const arrayBufferGuards = createInstanceGuards('ArrayBuffer', ArrayBuffer);
|
|
184
|
+
export const isArrayBuffer = arrayBufferGuards.isArrayBuffer;
|
|
185
|
+
export const isNotArrayBuffer = arrayBufferGuards.isNotArrayBuffer;
|
|
186
|
+
export const assertArrayBuffer = arrayBufferGuards.assertArrayBuffer;
|
|
187
|
+
export const assertNotArrayBuffer = arrayBufferGuards.assertNotArrayBuffer;
|
|
188
|
+
export const assertArrayBufferPass = arrayBufferGuards.assertArrayBufferPass;
|
|
189
|
+
export const assertNotArrayBufferPass = arrayBufferGuards.assertNotArrayBufferPass;
|
|
190
|
+
const arrayBufferViewGuards = createGuards('ArrayBufferView', (value) => ArrayBuffer.isView(value));
|
|
191
|
+
export const isArrayBufferView = arrayBufferViewGuards.isArrayBufferView;
|
|
192
|
+
export const isNotArrayBufferView = arrayBufferViewGuards.isNotArrayBufferView;
|
|
193
|
+
export const assertArrayBufferView = arrayBufferViewGuards.assertArrayBufferView;
|
|
194
|
+
export const assertNotArrayBufferView = arrayBufferViewGuards.assertNotArrayBufferView;
|
|
195
|
+
export const assertArrayBufferViewPass = arrayBufferViewGuards.assertArrayBufferViewPass;
|
|
196
|
+
export const assertNotArrayBufferViewPass = arrayBufferViewGuards.assertNotArrayBufferViewPass;
|
|
197
|
+
const binaryDataGuards = createGuards('BinaryData', (value) => (isArrayBuffer(value) || isArrayBufferView(value)));
|
|
198
|
+
export const isBinaryData = binaryDataGuards.isBinaryData;
|
|
199
|
+
export const isNotBinaryData = binaryDataGuards.isNotBinaryData;
|
|
200
|
+
export const assertBinaryData = binaryDataGuards.assertBinaryData;
|
|
201
|
+
export const assertNotBinaryData = binaryDataGuards.assertNotBinaryData;
|
|
202
|
+
export const assertBinaryDataPass = binaryDataGuards.assertBinaryDataPass;
|
|
203
|
+
export const assertNotBinaryDataPass = binaryDataGuards.assertNotBinaryDataPass;
|
|
204
|
+
const int8ArrayGuards = createInstanceGuards('Int8Array', Int8Array);
|
|
205
|
+
export const isInt8Array = int8ArrayGuards.isInt8Array;
|
|
206
|
+
export const isNotInt8Array = int8ArrayGuards.isNotInt8Array;
|
|
207
|
+
export const assertInt8Array = int8ArrayGuards.assertInt8Array;
|
|
208
|
+
export const assertNotInt8Array = int8ArrayGuards.assertNotInt8Array;
|
|
209
|
+
export const assertInt8ArrayPass = int8ArrayGuards.assertInt8ArrayPass;
|
|
210
|
+
export const assertNotInt8ArrayPass = int8ArrayGuards.assertNotInt8ArrayPass;
|
|
211
|
+
const uint8ArrayGuards = createInstanceGuards('Uint8Array', Uint8Array);
|
|
212
|
+
export const isUint8Array = uint8ArrayGuards.isUint8Array;
|
|
213
|
+
export const isNotUint8Array = uint8ArrayGuards.isNotUint8Array;
|
|
214
|
+
export const assertUint8Array = uint8ArrayGuards.assertUint8Array;
|
|
215
|
+
export const assertNotUint8Array = uint8ArrayGuards.assertNotUint8Array;
|
|
216
|
+
export const assertUint8ArrayPass = uint8ArrayGuards.assertUint8ArrayPass;
|
|
217
|
+
export const assertNotUint8ArrayPass = uint8ArrayGuards.assertNotUint8ArrayPass;
|
|
218
|
+
const uint8ClampedArrayGuards = createInstanceGuards('Uint8ClampedArray', Uint8ClampedArray);
|
|
219
|
+
export const isUint8ClampedArray = uint8ClampedArrayGuards.isUint8ClampedArray;
|
|
220
|
+
export const isNotUint8ClampedArray = uint8ClampedArrayGuards.isNotUint8ClampedArray;
|
|
221
|
+
export const assertUint8ClampedArray = uint8ClampedArrayGuards.assertUint8ClampedArray;
|
|
222
|
+
export const assertNotUint8ClampedArray = uint8ClampedArrayGuards.assertNotUint8ClampedArray;
|
|
223
|
+
export const assertUint8ClampedArrayPass = uint8ClampedArrayGuards.assertUint8ClampedArrayPass;
|
|
224
|
+
export const assertNotUint8ClampedArrayPass = uint8ClampedArrayGuards.assertNotUint8ClampedArrayPass;
|
|
225
|
+
const int16ArrayGuards = createInstanceGuards('Int16Array', Int16Array);
|
|
226
|
+
export const isInt16Array = int16ArrayGuards.isInt16Array;
|
|
227
|
+
export const isNotInt16Array = int16ArrayGuards.isNotInt16Array;
|
|
228
|
+
export const assertInt16Array = int16ArrayGuards.assertInt16Array;
|
|
229
|
+
export const assertNotInt16Array = int16ArrayGuards.assertNotInt16Array;
|
|
230
|
+
export const assertInt16ArrayPass = int16ArrayGuards.assertInt16ArrayPass;
|
|
231
|
+
export const assertNotInt16ArrayPass = int16ArrayGuards.assertNotInt16ArrayPass;
|
|
232
|
+
const uint16ArrayGuards = createInstanceGuards('Uint16Array', Uint16Array);
|
|
233
|
+
export const isUint16Array = uint16ArrayGuards.isUint16Array;
|
|
234
|
+
export const isNotUint16Array = uint16ArrayGuards.isNotUint16Array;
|
|
235
|
+
export const assertUint16Array = uint16ArrayGuards.assertUint16Array;
|
|
236
|
+
export const assertNotUint16Array = uint16ArrayGuards.assertNotUint16Array;
|
|
237
|
+
export const assertUint16ArrayPass = uint16ArrayGuards.assertUint16ArrayPass;
|
|
238
|
+
export const assertNotUint16ArrayPass = uint16ArrayGuards.assertNotUint16ArrayPass;
|
|
239
|
+
const int32ArrayGuards = createInstanceGuards('Int32Array', Int32Array);
|
|
240
|
+
export const isInt32Array = int32ArrayGuards.isInt32Array;
|
|
241
|
+
export const isNotInt32Array = int32ArrayGuards.isNotInt32Array;
|
|
242
|
+
export const assertInt32Array = int32ArrayGuards.assertInt32Array;
|
|
243
|
+
export const assertNotInt32Array = int32ArrayGuards.assertNotInt32Array;
|
|
244
|
+
export const assertInt32ArrayPass = int32ArrayGuards.assertInt32ArrayPass;
|
|
245
|
+
export const assertNotInt32ArrayPass = int32ArrayGuards.assertNotInt32ArrayPass;
|
|
246
|
+
const uint32ArrayGuards = createInstanceGuards('Uint32Array', Uint32Array);
|
|
247
|
+
export const isUint32Array = uint32ArrayGuards.isUint32Array;
|
|
248
|
+
export const isNotUint32Array = uint32ArrayGuards.isNotUint32Array;
|
|
249
|
+
export const assertUint32Array = uint32ArrayGuards.assertUint32Array;
|
|
250
|
+
export const assertNotUint32Array = uint32ArrayGuards.assertNotUint32Array;
|
|
251
|
+
export const assertUint32ArrayPass = uint32ArrayGuards.assertUint32ArrayPass;
|
|
252
|
+
export const assertNotUint32ArrayPass = uint32ArrayGuards.assertNotUint32ArrayPass;
|
|
253
|
+
const float32ArrayGuards = createInstanceGuards('Float32Array', Float32Array);
|
|
254
|
+
export const isFloat32Array = float32ArrayGuards.isFloat32Array;
|
|
255
|
+
export const isNotFloat32Array = float32ArrayGuards.isNotFloat32Array;
|
|
256
|
+
export const assertFloat32Array = float32ArrayGuards.assertFloat32Array;
|
|
257
|
+
export const assertNotFloat32Array = float32ArrayGuards.assertNotFloat32Array;
|
|
258
|
+
export const assertFloat32ArrayPass = float32ArrayGuards.assertFloat32ArrayPass;
|
|
259
|
+
export const assertNotFloat32ArrayPass = float32ArrayGuards.assertNotFloat32ArrayPass;
|
|
260
|
+
const float64ArrayGuards = createInstanceGuards('Float64Array', Float64Array);
|
|
261
|
+
export const isFloat64Array = float64ArrayGuards.isFloat64Array;
|
|
262
|
+
export const isNotFloat64Array = float64ArrayGuards.isNotFloat64Array;
|
|
263
|
+
export const assertFloat64Array = float64ArrayGuards.assertFloat64Array;
|
|
264
|
+
export const assertNotFloat64Array = float64ArrayGuards.assertNotFloat64Array;
|
|
265
|
+
export const assertFloat64ArrayPass = float64ArrayGuards.assertFloat64ArrayPass;
|
|
266
|
+
export const assertNotFloat64ArrayPass = float64ArrayGuards.assertNotFloat64ArrayPass;
|
|
267
|
+
const bigInt64ArrayGuards = createInstanceGuards('BigInt64Array', BigInt64Array);
|
|
268
|
+
export const isBigInt64Array = bigInt64ArrayGuards.isBigInt64Array;
|
|
269
|
+
export const isNotBigInt64Array = bigInt64ArrayGuards.isNotBigInt64Array;
|
|
270
|
+
export const assertBigInt64Array = bigInt64ArrayGuards.assertBigInt64Array;
|
|
271
|
+
export const assertNotBigInt64Array = bigInt64ArrayGuards.assertNotBigInt64Array;
|
|
272
|
+
export const assertBigInt64ArrayPass = bigInt64ArrayGuards.assertBigInt64ArrayPass;
|
|
273
|
+
export const assertNotBigInt64ArrayPass = bigInt64ArrayGuards.assertNotBigInt64ArrayPass;
|
|
274
|
+
const bigUint64ArrayGuards = createInstanceGuards('BigUint64Array', BigUint64Array);
|
|
275
|
+
export const isBigUint64Array = bigUint64ArrayGuards.isBigUint64Array;
|
|
276
|
+
export const isNotBigUint64Array = bigUint64ArrayGuards.isNotBigUint64Array;
|
|
277
|
+
export const assertBigUint64Array = bigUint64ArrayGuards.assertBigUint64Array;
|
|
278
|
+
export const assertNotBigUint64Array = bigUint64ArrayGuards.assertNotBigUint64Array;
|
|
279
|
+
export const assertBigUint64ArrayPass = bigUint64ArrayGuards.assertBigUint64ArrayPass;
|
|
280
|
+
export const assertNotBigUint64ArrayPass = bigUint64ArrayGuards.assertNotBigUint64ArrayPass;
|
|
281
|
+
const dataViewGuards = createInstanceGuards('DataView', DataView);
|
|
282
|
+
export const isDataView = dataViewGuards.isDataView;
|
|
283
|
+
export const isNotDataView = dataViewGuards.isNotDataView;
|
|
284
|
+
export const assertDataView = dataViewGuards.assertDataView;
|
|
285
|
+
export const assertNotDataView = dataViewGuards.assertNotDataView;
|
|
286
|
+
export const assertDataViewPass = dataViewGuards.assertDataViewPass;
|
|
287
|
+
export const assertNotDataViewPass = dataViewGuards.assertNotDataViewPass;
|
|
288
|
+
const typedArrayGuards = createGuards('TypedArray', (value) => (ArrayBuffer.isView(value) && isNotDataView(value)));
|
|
289
|
+
export const isTypedArray = typedArrayGuards.isTypedArray;
|
|
290
|
+
export const isNotTypedArray = typedArrayGuards.isNotTypedArray;
|
|
291
|
+
export const assertTypedArray = typedArrayGuards.assertTypedArray;
|
|
292
|
+
export const assertNotTypedArray = typedArrayGuards.assertNotTypedArray;
|
|
293
|
+
export const assertTypedArrayPass = typedArrayGuards.assertTypedArrayPass;
|
|
294
|
+
export const assertNotTypedArrayPass = typedArrayGuards.assertNotTypedArrayPass;
|
|
295
|
+
const setGuards = createInstanceGuards('Set', Set);
|
|
296
|
+
export const isSet = setGuards.isSet;
|
|
297
|
+
export const isNotSet = setGuards.isNotSet;
|
|
298
|
+
export const assertSet = setGuards.assertSet;
|
|
299
|
+
export const assertNotSet = setGuards.assertNotSet;
|
|
300
|
+
export const assertSetPass = setGuards.assertSetPass;
|
|
301
|
+
export const assertNotSetPass = setGuards.assertNotSetPass;
|
|
302
|
+
const mapGuards = createInstanceGuards('Map', Map);
|
|
303
|
+
export const isMap = mapGuards.isMap;
|
|
304
|
+
export const isNotMap = mapGuards.isNotMap;
|
|
305
|
+
export const assertMap = mapGuards.assertMap;
|
|
306
|
+
export const assertNotMap = mapGuards.assertNotMap;
|
|
307
|
+
export const assertMapPass = mapGuards.assertMapPass;
|
|
308
|
+
export const assertNotMapPass = mapGuards.assertNotMapPass;
|
|
309
|
+
const promiseGuards = createInstanceGuards('Promise', Promise);
|
|
310
|
+
export const isPromise = promiseGuards.isPromise;
|
|
311
|
+
export const isNotPromise = promiseGuards.isNotPromise;
|
|
312
|
+
export const assertPromise = promiseGuards.assertPromise;
|
|
313
|
+
export const assertNotPromise = promiseGuards.assertNotPromise;
|
|
314
|
+
export const assertPromisePass = promiseGuards.assertPromisePass;
|
|
315
|
+
export const assertNotPromisePass = promiseGuards.assertNotPromisePass;
|
|
316
|
+
const errorGuards = createInstanceGuards('error', Error);
|
|
317
|
+
export const isError = errorGuards.isError;
|
|
318
|
+
export const isNotError = errorGuards.isNotError;
|
|
319
|
+
export const assertError = errorGuards.assertError;
|
|
320
|
+
export const assertNotError = errorGuards.assertNotError;
|
|
321
|
+
export const assertErrorPass = errorGuards.assertErrorPass;
|
|
322
|
+
export const assertNotErrorPass = errorGuards.assertNotErrorPass;
|
|
323
|
+
const readableStreamGuards = createGuards('ReadableStream', (value) => (supportsReadableStream && (value instanceof ReadableStream)));
|
|
324
|
+
export const isReadableStream = readableStreamGuards.isReadableStream;
|
|
325
|
+
export const isNotReadableStream = readableStreamGuards.isNotReadableStream;
|
|
326
|
+
export const assertReadableStream = readableStreamGuards.assertReadableStream;
|
|
327
|
+
export const assertNotReadableStream = readableStreamGuards.assertNotReadableStream;
|
|
328
|
+
export const assertReadableStreamPass = readableStreamGuards.assertReadableStreamPass;
|
|
329
|
+
export const assertNotReadableStreamPass = readableStreamGuards.assertNotReadableStreamPass;
|