arcane-os 0.5.17 → 0.5.19
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/CHANGELOG.md +34 -1
- package/README.md +9 -9
- package/bin/arcane-test.mjs +16 -13
- package/browser-runtime/ai/browser-speech-artifacts.mjs +41 -38
- package/browser-runtime/ai/browser-speech-providers.mjs +46 -43
- package/browser-runtime/ai/browser-wasm-llm-provider.mjs +158 -135
- package/browser-runtime/ai/browser-wasm.mjs +6 -3
- package/browser-runtime/ai/browser-wllama-runtime.mjs +104 -23
- package/browser-runtime/ai/model-controller.mjs +94 -91
- package/browser-runtime/ai/speech-worker-client.mjs +12 -9
- package/browser-runtime/ai/speech-worker-runtime.mjs +56 -53
- package/browser-runtime/dependencies/strong-type/index.js +207 -82
- package/browser-runtime/dependencies/strong-type/package.json +15 -6
- package/browser-runtime/dom-event-instrumentation.mjs +24 -20
- package/browser-runtime/event-manager.mjs +111 -108
- package/browser-runtime/speech-text.mjs +5 -1
- package/docs/architecture.md +1 -1
- package/docs/publishing.md +10 -4
- package/docs/reference/ai/browser-speech.md +198 -5
- package/docs/reference/ai/browser-wasm.md +29 -6
- package/docs/reference/availability-and-normalization.md +40 -0
- package/docs/reference/inventory/package-api.json +1 -1
- package/docs/reference/inventory/runtime-components.json +1 -1
- package/docs/reference/inventory/runtime-modules.json +20 -24
- package/docs/reference/protocols.md +1 -1
- package/docs/reference/runtime-modules.md +125 -35
- package/docs/reference/sdk-api.md +23 -7
- package/examples/wasm-ai-demo/index.html +1 -0
- package/node_modules/event-pubsub/node_modules/strong-type/README.md +408 -0
- package/node_modules/event-pubsub/node_modules/strong-type/assets/strong-type-header.png +0 -0
- package/node_modules/event-pubsub/node_modules/strong-type/index.js +1151 -0
- package/node_modules/event-pubsub/node_modules/strong-type/licence +21 -0
- package/node_modules/event-pubsub/node_modules/strong-type/node.js +125 -0
- package/node_modules/event-pubsub/node_modules/strong-type/package.json +61 -0
- package/node_modules/strong-type/README.md +42 -24
- package/node_modules/strong-type/benchmark/core.js +324 -0
- package/node_modules/strong-type/index.js +207 -82
- package/node_modules/strong-type/package.json +14 -6
- package/package.json +3 -3
- package/runtime/arcane/components/app-bar.html +5 -2
- package/runtime/arcane/components/assistant-panel.html +5 -2
- package/runtime/arcane/components/chart.html +15 -12
- package/runtime/arcane/components/chat.html +170 -148
- package/runtime/arcane/components/dashboard-config.html +6 -3
- package/runtime/arcane/components/data-view.html +4 -1
- package/runtime/arcane/components/directory-picker.html +5 -2
- package/runtime/arcane/components/document-inspector.html +6 -3
- package/runtime/arcane/components/file-drop.html +5 -2
- package/runtime/arcane/components/file-inspector.html +9 -6
- package/runtime/arcane/components/file-manager.html +16 -13
- package/runtime/arcane/components/local-ai-status.html +5 -2
- package/runtime/arcane/components/markdown-document.html +14 -11
- package/runtime/arcane/components/markdown-editor.html +4 -1
- package/runtime/arcane/components/modal.html +4 -1
- package/runtime/arcane/components/output-panel.html +6 -3
- package/runtime/arcane/components/preferences-form.html +4 -1
- package/runtime/arcane/components/record-timeline.html +8 -5
- package/runtime/arcane/components/relationship-board.html +9 -6
- package/runtime/arcane/components/source-code-viewer.html +12 -9
- package/runtime/arcane/components/source-explanation.html +8 -5
- package/runtime/arcane/components/speech.html +24 -21
- package/runtime/arcane/components/summary-strip.html +4 -1
- package/runtime/arcane/components/task-progress.html +6 -3
- package/runtime/arcane/components/terminal-workspace.html +4 -1
- package/runtime/arcane/components/voice-transcription.html +11 -8
- package/runtime/arcane/components/web-navigator.html +5 -2
- package/runtime/arcane/entities/ApiModelRecord.js +5 -2
- package/runtime/arcane/entities/Calculation.js +5 -2
- package/runtime/arcane/entities/Chat.js +33 -33
- package/runtime/arcane/entities/CommunicationMessage.js +4 -1
- package/runtime/arcane/entities/CommunicationThread.js +4 -1
- package/runtime/arcane/entities/File.js +1 -1
- package/runtime/arcane/entities/Image.js +8 -5
- package/runtime/arcane/entities/IntentEnvelope.js +20 -17
- package/runtime/arcane/entities/Preference.js +9 -6
- package/runtime/arcane/entities/Theme.js +5 -2
- package/runtime/arcane/entities/User.js +11 -11
- package/runtime/arcane/entities/Weather.js +5 -2
- package/runtime/arcane/modules/AI.js +491 -165
- package/runtime/arcane/modules/AIPreferenceRuntime.js +5 -2
- package/runtime/arcane/modules/AIPreferenceTuple.js +9 -6
- package/runtime/arcane/modules/AIProviderRuntime.js +88 -85
- package/runtime/arcane/modules/AIResponseURLPolicy.js +148 -62
- package/runtime/arcane/modules/AIRuntimeState.js +29 -26
- package/runtime/arcane/modules/AnsiText.js +4 -1
- package/runtime/arcane/modules/ApiModelDatabase.js +22 -19
- package/runtime/arcane/modules/AppDataScope.js +8 -5
- package/runtime/arcane/modules/ArcaneCommunicationBridge.js +4 -1
- package/runtime/arcane/modules/ArcaneNavigationPolicy.js +8 -5
- package/runtime/arcane/modules/ArcaneNetworkPolicy.js +18 -15
- package/runtime/arcane/modules/AsyncBoundary.js +13 -10
- package/runtime/arcane/modules/BrowserTestSuite.js +19 -16
- package/runtime/arcane/modules/CalculatorEngine.js +5 -2
- package/runtime/arcane/modules/ChatRecords.js +18 -15
- package/runtime/arcane/modules/CommunicationAppController.js +9 -6
- package/runtime/arcane/modules/CommunicationHub.js +9 -6
- package/runtime/arcane/modules/CommunicationPreferences.js +4 -1
- package/runtime/arcane/modules/CommunicationProviderRegistry.js +4 -1
- package/runtime/arcane/modules/ComponentContracts.js +56 -53
- package/runtime/arcane/modules/ConfiguredAIChatSession.js +30 -27
- package/runtime/arcane/modules/ConversationActionItems.js +15 -12
- package/runtime/arcane/modules/ConversationClosingReport.js +11 -8
- package/runtime/arcane/modules/ConversationTimebox.js +28 -25
- package/runtime/arcane/modules/CoreLocalModelCatalog.js +17 -14
- package/runtime/arcane/modules/DBLS.js +7 -4
- package/runtime/arcane/modules/DBOPFS.js +7 -7
- package/runtime/arcane/modules/DBOPFSDocumentLibrary.js +34 -31
- package/runtime/arcane/modules/DevelopmentWorkspace.js +4 -1
- package/runtime/arcane/modules/DirectoryPicker.js +8 -5
- package/runtime/arcane/modules/DocumentLexicalSearch.js +11 -8
- package/runtime/arcane/modules/DocumentNavigation.js +7 -4
- package/runtime/arcane/modules/Errors.js +28 -25
- package/runtime/arcane/modules/HTMLImport.js +7 -4
- package/runtime/arcane/modules/IsolatedModelQuestionRunner.js +15 -12
- package/runtime/arcane/modules/LocalAIReadiness.js +21 -18
- package/runtime/arcane/modules/LocalAIReadinessController.js +6 -3
- package/runtime/arcane/modules/MD.js +1 -1
- package/runtime/arcane/modules/Mail.js +46 -43
- package/runtime/arcane/modules/MailOutbox.mjs +48 -45
- package/runtime/arcane/modules/MailTransport.mjs +29 -26
- package/runtime/arcane/modules/MemoryRecords.js +7 -4
- package/runtime/arcane/modules/MessageAdvisory.js +6 -3
- package/runtime/arcane/modules/ModelDefinition.js +7 -4
- package/runtime/arcane/modules/Ollama.js +6 -3
- package/runtime/arcane/modules/OllamaModelIdentifier.js +4 -1
- package/runtime/arcane/modules/OpenMeteoWeatherProvider.js +18 -15
- package/runtime/arcane/modules/PersistentAIChatSession.js +33 -30
- package/runtime/arcane/modules/PreferenceStore.js +20 -17
- package/runtime/arcane/modules/PreparedSpeech.js +485 -0
- package/runtime/arcane/modules/Questionnaire.js +6 -3
- package/runtime/arcane/modules/RecordLinkIndex.js +4 -1
- package/runtime/arcane/modules/RecordPassageIndex.js +9 -6
- package/runtime/arcane/modules/RecordReviewStore.js +12 -9
- package/runtime/arcane/modules/RiskSignalAnalyzer.js +4 -1
- package/runtime/arcane/modules/ScopedOPFSCache.js +6 -3
- package/runtime/arcane/modules/ScreenCapture.js +20 -17
- package/runtime/arcane/modules/SpeechPlayback.js +29 -26
- package/runtime/arcane/modules/StaticDocumentCatalog.js +33 -30
- package/runtime/arcane/modules/SystemAppearance.js +5 -2
- package/runtime/arcane/modules/SystemToolRegistry.js +6 -3
- package/runtime/arcane/modules/TerminalClient.js +14 -11
- package/runtime/arcane/modules/TerminalCommandRegistry.js +4 -1
- package/runtime/arcane/modules/ThemeBootstrap.js +9 -6
- package/runtime/arcane/modules/ThemeManager.js +5 -2
- package/runtime/arcane/modules/TimeGuard.js +1 -1
- package/runtime/arcane/modules/ToolCallRouter.js +11 -8
- package/runtime/arcane/modules/WaitForComponent.js +19 -16
- package/runtime/arcane/modules/YouTubeMedia.js +4 -1
- package/runtime/strong-type/index.js +1276 -352
- package/runtime/strong-type/package.json +69 -45
- package/src/app-descriptor.mjs +17 -14
- package/src/application-tests.mjs +4 -1
- package/src/cli/main.mjs +8 -5
- package/src/constants.mjs +4 -1
- package/src/dev-server.mjs +8 -5
- package/src/doctor.mjs +5 -2
- package/src/dom-event-instrumentation.mjs +24 -20
- package/src/errors.mjs +7 -3
- package/src/event-manager.mjs +111 -108
- package/src/event-queue.mjs +8 -5
- package/src/events.mjs +12 -9
- package/src/import-map.mjs +35 -27
- package/src/installed-sdk-runtime.mjs +4 -1
- package/src/integrated-provider-loader.mjs +9 -6
- package/src/mail-credentials.mjs +16 -13
- package/src/mail-server.mjs +53 -50
- package/src/mail.mjs +18 -15
- package/src/native-plan.mjs +12 -9
- package/src/native-provider-loader.mjs +7 -4
- package/src/packager/core.mjs +18 -15
- package/src/process.mjs +6 -3
- package/src/release-bundle.mjs +14 -11
- package/src/runtime.mjs +4 -1
- package/src/scaffold.mjs +9 -6
- package/src/sdk-browser-runtime.mjs +4 -1
- package/src/source-server.mjs +17 -14
- package/src/targets/index.mjs +5 -2
- package/src/templates/workspace-template.mjs +13 -6
- package/src/testing-loader.mjs +7 -4
- package/src/testing.mjs +10 -7
- package/src/toolchain.mjs +13 -10
- package/src/update-check.mjs +9 -6
- package/src/workspace-operation-lock.mjs +14 -11
- package/src/workspace-runtime.mjs +4 -1
- package/src/workspace.mjs +17 -14
- package/runtime/arcane/modules/AIResponseLength.js +0 -32
|
@@ -1,352 +1,1276 @@
|
|
|
1
|
-
class Fake{
|
|
2
|
-
//fake class as fallback
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
class FakeCore{
|
|
6
|
-
//fake class as fallback
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
return
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
return
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
return
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
return
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
1
|
+
class Fake{
|
|
2
|
+
//fake class as fallback
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
class FakeCore{
|
|
6
|
+
//fake class as fallback
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const brandProbe={};
|
|
10
|
+
const brandFailure=Symbol('strong-type brand failure');
|
|
11
|
+
const noArguments=Object.freeze([]);
|
|
12
|
+
const brandProbeArguments=Object.freeze([brandProbe]);
|
|
13
|
+
const emptyStringArguments=Object.freeze(['']);
|
|
14
|
+
const segmentProbeArguments=Object.freeze([-1]);
|
|
15
|
+
const functionToString=Function.prototype.toString;
|
|
16
|
+
const objectConstructorSource=functionToString.call(Object);
|
|
17
|
+
const objectGetPrototypeOf=Object.getPrototypeOf;
|
|
18
|
+
const reflectApply=Reflect.apply;
|
|
19
|
+
|
|
20
|
+
const getterFor=function(prototype,property){
|
|
21
|
+
if(!prototype){
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
try{
|
|
26
|
+
const descriptor=Object.getOwnPropertyDescriptor(prototype,property);
|
|
27
|
+
return descriptor && typeof descriptor.get === 'function' ? descriptor.get : false;
|
|
28
|
+
}catch(err){
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const applyBrand=function(value,check,args=noArguments){
|
|
34
|
+
if(typeof check !== 'function'){
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try{
|
|
39
|
+
reflectApply(check,value,args);
|
|
40
|
+
return true;
|
|
41
|
+
}catch(err){
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const applyValue=function(value,check,args=noArguments){
|
|
47
|
+
if(typeof check !== 'function'){
|
|
48
|
+
return brandFailure;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
try{
|
|
52
|
+
return reflectApply(check,value,args);
|
|
53
|
+
}catch(err){
|
|
54
|
+
return brandFailure;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const methodBrand=function(value,prototype,method,args=noArguments){
|
|
59
|
+
if(!prototype){
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
let check;
|
|
64
|
+
try{
|
|
65
|
+
check=prototype[method];
|
|
66
|
+
}catch(err){
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return applyBrand(value,check,args);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const getterBrand=function(value,prototype,property){
|
|
73
|
+
return applyBrand(value,getterFor(prototype,property));
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const instanceOf=function(value,constructor){
|
|
77
|
+
if(typeof constructor !== 'function'){
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
try{
|
|
82
|
+
return value instanceof constructor;
|
|
83
|
+
}catch(err){
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const stringTagCheck=function(value,type){
|
|
89
|
+
try{
|
|
90
|
+
return Object.prototype.toString.call(value) === `[object ${type}]`;
|
|
91
|
+
}catch(err){
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const arrayBufferByteLengthGetter=getterFor(globalThis.ArrayBuffer && globalThis.ArrayBuffer.prototype,'byteLength');
|
|
97
|
+
const arrayBufferResizableGetter=getterFor(globalThis.ArrayBuffer && globalThis.ArrayBuffer.prototype,'resizable');
|
|
98
|
+
const sharedArrayBufferByteLengthGetter=getterFor(globalThis.SharedArrayBuffer && globalThis.SharedArrayBuffer.prototype,'byteLength');
|
|
99
|
+
const sharedArrayBufferGrowableGetter=getterFor(globalThis.SharedArrayBuffer && globalThis.SharedArrayBuffer.prototype,'growable');
|
|
100
|
+
const dataViewByteLengthGetter=getterFor(globalThis.DataView && globalThis.DataView.prototype,'byteLength');
|
|
101
|
+
const regExpSourceGetter=getterFor(globalThis.RegExp && globalThis.RegExp.prototype,'source');
|
|
102
|
+
const intlDateTimeFormatGetter=getterFor(globalThis.Intl && globalThis.Intl.DateTimeFormat && globalThis.Intl.DateTimeFormat.prototype,'format');
|
|
103
|
+
const intlCollatorCompareGetter=getterFor(globalThis.Intl && globalThis.Intl.Collator && globalThis.Intl.Collator.prototype,'compare');
|
|
104
|
+
const intlNumberFormatGetter=getterFor(globalThis.Intl && globalThis.Intl.NumberFormat && globalThis.Intl.NumberFormat.prototype,'format');
|
|
105
|
+
const dateGetTime=Date.prototype.getTime;
|
|
106
|
+
const mapHas=Map.prototype.has;
|
|
107
|
+
const weakMapHas=WeakMap.prototype.has;
|
|
108
|
+
const setHas=Set.prototype.has;
|
|
109
|
+
const weakSetHas=WeakSet.prototype.has;
|
|
110
|
+
const booleanValueOf=Boolean.prototype.valueOf;
|
|
111
|
+
const numberValueOf=Number.prototype.valueOf;
|
|
112
|
+
const bigIntValueOf=globalThis.BigInt && globalThis.BigInt.prototype.valueOf;
|
|
113
|
+
const stringValueOf=String.prototype.valueOf;
|
|
114
|
+
const symbolValueOf=globalThis.Symbol && globalThis.Symbol.prototype.valueOf;
|
|
115
|
+
|
|
116
|
+
const arrayBufferCheck=function(value){
|
|
117
|
+
return applyBrand(value,arrayBufferByteLengthGetter);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const sharedArrayBufferCheck=function(value){
|
|
121
|
+
return applyBrand(value,sharedArrayBufferByteLengthGetter);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const dataViewCheck=function(value){
|
|
125
|
+
return applyBrand(value,dataViewByteLengthGetter);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const arrayBufferViewCheck=function(value){
|
|
129
|
+
try{
|
|
130
|
+
return ArrayBuffer.isView(value);
|
|
131
|
+
}catch(err){
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const typedArrayTagGetter=(function(){
|
|
137
|
+
const prototype=Object.getPrototypeOf(Uint8Array.prototype);
|
|
138
|
+
const descriptor=Object.getOwnPropertyDescriptor(prototype,Symbol.toStringTag);
|
|
139
|
+
return descriptor && descriptor.get;
|
|
140
|
+
})();
|
|
141
|
+
|
|
142
|
+
const typedArrayName=function(value){
|
|
143
|
+
if(!arrayBufferViewCheck(value) || typeof typedArrayTagGetter !== 'function'){
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const name=applyValue(value,typedArrayTagGetter);
|
|
148
|
+
return name === brandFailure ? false : name;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const dateCheck=function(value){
|
|
152
|
+
return applyBrand(value,dateGetTime);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const validDateCheck=function(value){
|
|
156
|
+
const time=applyValue(value,dateGetTime);
|
|
157
|
+
return time !== brandFailure && !Number.isNaN(time);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const mapCheck=function(value){
|
|
161
|
+
return applyBrand(value,mapHas,brandProbeArguments);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const weakMapCheck=function(value){
|
|
165
|
+
return applyBrand(value,weakMapHas,brandProbeArguments);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const setCheck=function(value){
|
|
169
|
+
return applyBrand(value,setHas,brandProbeArguments);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const weakSetCheck=function(value){
|
|
173
|
+
return applyBrand(value,weakSetHas,brandProbeArguments);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const regExpCheck=function(value){
|
|
177
|
+
return applyBrand(value,regExpSourceGetter);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const boxedBooleanCheck=function(value){
|
|
181
|
+
return typeof value === 'object' && value !== null && applyBrand(value,booleanValueOf);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const boxedNumberCheck=function(value){
|
|
185
|
+
return typeof value === 'object' && value !== null && applyBrand(value,numberValueOf);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const boxedBigIntCheck=function(value){
|
|
189
|
+
return typeof value === 'object' && value !== null && applyBrand(value,bigIntValueOf);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const boxedStringCheck=function(value){
|
|
193
|
+
return typeof value === 'object' && value !== null && applyBrand(value,stringValueOf);
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const boxedSymbolCheck=function(value){
|
|
197
|
+
return typeof value === 'object' && value !== null && applyBrand(value,symbolValueOf);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const plainObjectCheck=function(value){
|
|
201
|
+
if(value === null || typeof value !== 'object'){
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
let prototype;
|
|
206
|
+
try{
|
|
207
|
+
prototype=Object.getPrototypeOf(value);
|
|
208
|
+
}catch(err){
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
if(prototype === null){
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if(!Object.prototype.hasOwnProperty.call(prototype,'constructor')){
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const constructor=prototype.constructor;
|
|
220
|
+
return typeof constructor === 'function' && functionToString.call(constructor) === objectConstructorSource;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const protocolCheck=function(value,symbol,method){
|
|
224
|
+
if(value === null || value === undefined){
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const key=typeof symbol === 'symbol' ? symbol : method;
|
|
229
|
+
if(typeof key !== 'symbol' && typeof key !== 'string'){
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
try{
|
|
234
|
+
return typeof value[key] === 'function';
|
|
235
|
+
}catch(err){
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const blockedUnionMethods=new Set([
|
|
241
|
+
'constructor',
|
|
242
|
+
'throw',
|
|
243
|
+
'check',
|
|
244
|
+
'typeCheck',
|
|
245
|
+
'instanceCheck',
|
|
246
|
+
'symbolStringCheck',
|
|
247
|
+
'compare',
|
|
248
|
+
'globalInstanceCheck',
|
|
249
|
+
'nestedInstanceCheck',
|
|
250
|
+
'globalValueCheck',
|
|
251
|
+
'nestedValueCheck',
|
|
252
|
+
'union'
|
|
253
|
+
]);
|
|
254
|
+
|
|
255
|
+
const unionNamesCache=new Map;
|
|
256
|
+
const unionNamesCacheLimit=128;
|
|
257
|
+
|
|
258
|
+
const normalizeUnionNames=function(types){
|
|
259
|
+
if(typeof types === 'string' && unionNamesCache.has(types)){
|
|
260
|
+
return unionNamesCache.get(types);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const source=Array.isArray(types) ? types : typeof types === 'string' ? types.split('|') : [];
|
|
264
|
+
const names=[];
|
|
265
|
+
const length=source.length;
|
|
266
|
+
for(let index=0;index<length;index++){
|
|
267
|
+
const type=source[index];
|
|
268
|
+
if(typeof type !== 'string'){
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
const name=type.trim();
|
|
272
|
+
if(name){
|
|
273
|
+
names.push(name);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if(typeof types === 'string'){
|
|
278
|
+
if(unionNamesCache.size >= unionNamesCacheLimit){
|
|
279
|
+
unionNamesCache.delete(unionNamesCache.keys().next().value);
|
|
280
|
+
}
|
|
281
|
+
Object.freeze(names);
|
|
282
|
+
unionNamesCache.set(types,names);
|
|
283
|
+
}
|
|
284
|
+
return names;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
let cachedSegmenterConstructor;
|
|
288
|
+
let cachedSegmentMethod;
|
|
289
|
+
let cachedSegmentsPrototype;
|
|
290
|
+
let cachedSegmentsContaining;
|
|
291
|
+
const segmentsContainingFor=function(constructor){
|
|
292
|
+
if(typeof constructor !== 'function'){
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
let segment;
|
|
297
|
+
try{
|
|
298
|
+
segment=constructor.prototype && constructor.prototype.segment;
|
|
299
|
+
}catch(err){
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
if(typeof segment !== 'function'){
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
305
|
+
if(constructor === cachedSegmenterConstructor && segment === cachedSegmentMethod && typeof cachedSegmentsContaining === 'function'){
|
|
306
|
+
try{
|
|
307
|
+
if(cachedSegmentsPrototype && cachedSegmentsPrototype.containing === cachedSegmentsContaining){
|
|
308
|
+
return cachedSegmentsContaining;
|
|
309
|
+
}
|
|
310
|
+
}catch(err){
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
try{
|
|
316
|
+
const prototype=objectGetPrototypeOf(reflectApply(segment,new constructor,emptyStringArguments));
|
|
317
|
+
const containing=prototype && prototype.containing;
|
|
318
|
+
if(typeof containing === 'function'){
|
|
319
|
+
cachedSegmenterConstructor=constructor;
|
|
320
|
+
cachedSegmentMethod=segment;
|
|
321
|
+
cachedSegmentsPrototype=prototype;
|
|
322
|
+
cachedSegmentsContaining=containing;
|
|
323
|
+
return containing;
|
|
324
|
+
}
|
|
325
|
+
}catch(err){
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
return false;
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
const validatorFor=function(target,name){
|
|
332
|
+
if(blockedUnionMethods.has(name)){
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
let current=target;
|
|
337
|
+
while(current && current !== Object.prototype){
|
|
338
|
+
const descriptor=Object.getOwnPropertyDescriptor(current,name);
|
|
339
|
+
if(descriptor && typeof descriptor.value === 'function' && descriptor.value.length <= 1){
|
|
340
|
+
return descriptor.value;
|
|
341
|
+
}
|
|
342
|
+
current=Object.getPrototypeOf(current);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
return false;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
class Is{
|
|
349
|
+
constructor(strict=true){
|
|
350
|
+
this.strict=strict;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
//core
|
|
354
|
+
throw(valueType,expectedType){
|
|
355
|
+
if(!this.strict){
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const err=new TypeError;
|
|
360
|
+
err.message=`expected type of ${valueType} to be ${expectedType}`;
|
|
361
|
+
throw err;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
check(value,pass,expectedType){
|
|
365
|
+
if(pass){
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
const valueType=value === null ? 'null' : typeof value;
|
|
370
|
+
return this.throw(valueType,expectedType);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
typeCheck(value,type){
|
|
374
|
+
return this.check(value,typeof value === type,type);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
instanceCheck(value=new Fake,constructor=FakeCore){
|
|
378
|
+
return this.check(value,instanceOf(value,constructor),constructor && constructor.name ? constructor.name : 'available constructor');
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
symbolStringCheck(value,type){
|
|
382
|
+
return this.check(value,stringTagCheck(value,type),`[object ${type}]`);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
compare(value,targetValue,typeName){
|
|
386
|
+
if(Object.is(value,targetValue)){
|
|
387
|
+
return this.check(value,true,typeName);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const expectedType=typeName === undefined ? String(targetValue) : typeName;
|
|
391
|
+
return this.check(value,false,expectedType);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
globalInstanceCheck(value,type){
|
|
395
|
+
return this.check(value,instanceOf(value,globalThis[type]),type);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
nestedInstanceCheck(value,container,type){
|
|
399
|
+
const constructor=container && container[type];
|
|
400
|
+
return this.check(value,instanceOf(value,constructor),type);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
globalValueCheck(value,type){
|
|
404
|
+
const available=Object.prototype.hasOwnProperty.call(globalThis,type);
|
|
405
|
+
return this.check(value,available && Object.is(value,globalThis[type]),type);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
nestedValueCheck(value,container,type){
|
|
409
|
+
const available=container && Object.prototype.hasOwnProperty.call(container,type);
|
|
410
|
+
return this.check(value,available && Object.is(value,container[type]),type);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
defined(value){
|
|
414
|
+
return this.check(value,value !== undefined,'defined');
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
any(value){
|
|
418
|
+
return this.defined(value);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
exists(value){
|
|
422
|
+
return this.defined(value);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
union(value,typesString){
|
|
426
|
+
const names=normalizeUnionNames(typesString);
|
|
427
|
+
if(!names.length){
|
|
428
|
+
return this.throw(typeof typesString,'a pipe-delimited string or array of strong-type methods');
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
const validators=new Array(names.length);
|
|
432
|
+
for(let index=0;index<names.length;index++){
|
|
433
|
+
const validator=validatorFor(this,names[index]);
|
|
434
|
+
if(!validator){
|
|
435
|
+
return this.throw(names[index],'a method available on strong-type');
|
|
436
|
+
}
|
|
437
|
+
validators[index]=validator;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
const weakIs=Object.create(this);
|
|
441
|
+
weakIs.strict=false;
|
|
442
|
+
for(let index=0;index<validators.length;index++){
|
|
443
|
+
try{
|
|
444
|
+
if(validators[index].call(weakIs,value)){
|
|
445
|
+
return true;
|
|
446
|
+
}
|
|
447
|
+
}catch(err){
|
|
448
|
+
//custom validators may throw even when strict is false
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
const fail=this.throw;
|
|
453
|
+
if(fail === defaultThrow && !this.strict){
|
|
454
|
+
return false;
|
|
455
|
+
}
|
|
456
|
+
return reflectApply(fail,this,[typeof value,names.join('|')]);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
//values and primitives
|
|
460
|
+
finite(value){
|
|
461
|
+
return this.check(value,Number.isFinite(value),'finite number');
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
finiteNumber(value){
|
|
465
|
+
return this.finite(value);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
NaN(value){
|
|
469
|
+
return this.check(value,Number.isNaN(value),'NaN');
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
nan(value){
|
|
473
|
+
return this.NaN(value);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
null(value){
|
|
477
|
+
return this.check(value,value === null,'null');
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
nullish(value){
|
|
481
|
+
return this.check(value,value === null || value === undefined,'null or undefined');
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
boolean(value){
|
|
485
|
+
return this.typeCheck(value,'boolean');
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
bigInt(value){
|
|
489
|
+
return this.typeCheck(value,'bigint');
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
bigint(value){
|
|
493
|
+
return this.bigInt(value);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
number(value){
|
|
497
|
+
return this.typeCheck(value,'number');
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
integer(value){
|
|
501
|
+
return this.check(value,Number.isInteger(value),'integer');
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
safeInteger(value){
|
|
505
|
+
return this.check(value,Number.isSafeInteger(value),'safe integer');
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
infinity(value){
|
|
509
|
+
return this.check(value,value === Infinity,'Infinity');
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
infinite(value){
|
|
513
|
+
return this.check(value,value === Infinity || value === -Infinity,'positive or negative Infinity');
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
positiveInfinity(value){
|
|
517
|
+
return this.infinity(value);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
negativeInfinity(value){
|
|
521
|
+
return this.check(value,value === -Infinity,'-Infinity');
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
negativeZero(value){
|
|
525
|
+
return this.check(value,Object.is(value,-0),'-0');
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
string(value){
|
|
529
|
+
return this.typeCheck(value,'string');
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
symbol(value){
|
|
533
|
+
return this.typeCheck(value,'symbol');
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
undefined(value){
|
|
537
|
+
return this.typeCheck(value,'undefined');
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
primitive(value){
|
|
541
|
+
const type=typeof value;
|
|
542
|
+
return this.check(value,value === null || (type !== 'object' && type !== 'function'),'primitive');
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
globalThis(value){
|
|
546
|
+
return this.compare(value,globalThis,'explicitly globalThis, not window, global nor self');
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
atomics(value){
|
|
550
|
+
return this.globalValueCheck(value,'Atomics');
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
json(value){
|
|
554
|
+
return this.globalValueCheck(value,'JSON');
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
math(value){
|
|
558
|
+
return this.globalValueCheck(value,'Math');
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
reflect(value){
|
|
562
|
+
return this.globalValueCheck(value,'Reflect');
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
rawJSON(value){
|
|
566
|
+
const check=globalThis.JSON && globalThis.JSON.isRawJSON;
|
|
567
|
+
let pass=false;
|
|
568
|
+
try{
|
|
569
|
+
pass=typeof check === 'function' && check(value);
|
|
570
|
+
}catch(err){
|
|
571
|
+
pass=false;
|
|
572
|
+
}
|
|
573
|
+
return this.check(value,pass,'raw JSON');
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
//objects and collections
|
|
577
|
+
array(value){
|
|
578
|
+
let pass=false;
|
|
579
|
+
try{
|
|
580
|
+
pass=Array.isArray(value);
|
|
581
|
+
}catch(err){
|
|
582
|
+
pass=false;
|
|
583
|
+
}
|
|
584
|
+
return this.check(value,pass,'Array');
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
date(value){
|
|
588
|
+
return this.check(value,dateCheck(value),'Date');
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
validDate(value){
|
|
592
|
+
return this.check(value,validDateCheck(value),'valid Date');
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
map(value){
|
|
596
|
+
return this.check(value,mapCheck(value),'Map');
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
weakMap(value){
|
|
600
|
+
return this.check(value,weakMapCheck(value),'WeakMap');
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
object(value){
|
|
604
|
+
return this.typeCheck(value,'object');
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
nonNullObject(value){
|
|
608
|
+
return this.check(value,value !== null && typeof value === 'object','non-null object');
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
plainObject(value){
|
|
612
|
+
return this.check(value,plainObjectCheck(value),'plain object');
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
nullPrototypeObject(value){
|
|
616
|
+
let pass=false;
|
|
617
|
+
if(value !== null && typeof value === 'object'){
|
|
618
|
+
try{
|
|
619
|
+
pass=Object.getPrototypeOf(value) === null;
|
|
620
|
+
}catch(err){
|
|
621
|
+
pass=false;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
return this.check(value,pass,'null-prototype object');
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
argumentsObject(value){
|
|
628
|
+
return this.symbolStringCheck(value,'Arguments');
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
promise(value){
|
|
632
|
+
return this.globalInstanceCheck(value,'Promise');
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
thenable(value){
|
|
636
|
+
const pass=value !== null && value !== undefined && (typeof value === 'object' || typeof value === 'function') && protocolCheck(value,false,'then');
|
|
637
|
+
return this.check(value,pass,'thenable');
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
regExp(value){
|
|
641
|
+
return this.check(value,regExpCheck(value),'RegExp');
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
regexp(value){
|
|
645
|
+
return this.regExp(value);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
set(value){
|
|
649
|
+
return this.check(value,setCheck(value),'Set');
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
weakSet(value){
|
|
653
|
+
return this.check(value,weakSetCheck(value),'WeakSet');
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
//boxed primitives
|
|
657
|
+
boxedPrimitive(value){
|
|
658
|
+
const pass=boxedBooleanCheck(value) || boxedNumberCheck(value) || boxedBigIntCheck(value) || boxedStringCheck(value) || boxedSymbolCheck(value);
|
|
659
|
+
return this.check(value,pass,'boxed primitive');
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
booleanObject(value){
|
|
663
|
+
return this.check(value,boxedBooleanCheck(value),'Boolean object');
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
numberObject(value){
|
|
667
|
+
return this.check(value,boxedNumberCheck(value),'Number object');
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
bigIntObject(value){
|
|
671
|
+
return this.check(value,boxedBigIntCheck(value),'BigInt object');
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
stringObject(value){
|
|
675
|
+
return this.check(value,boxedStringCheck(value),'String object');
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
symbolObject(value){
|
|
679
|
+
return this.check(value,boxedSymbolCheck(value),'Symbol object');
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
//functions and protocols
|
|
683
|
+
function(value){
|
|
684
|
+
return this.typeCheck(value,'function');
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
callable(value){
|
|
688
|
+
return this.function(value);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
asyncFunction(value){
|
|
692
|
+
return this.symbolStringCheck(value,'AsyncFunction');
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
generatorFunction(value){
|
|
696
|
+
return this.symbolStringCheck(value,'GeneratorFunction');
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
asyncGeneratorFunction(value){
|
|
700
|
+
return this.symbolStringCheck(value,'AsyncGeneratorFunction');
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
generator(value){
|
|
704
|
+
return this.symbolStringCheck(value,'Generator');
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
asyncGenerator(value){
|
|
708
|
+
return this.symbolStringCheck(value,'AsyncGenerator');
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
iterator(value){
|
|
712
|
+
const pass=value !== null && value !== undefined && protocolCheck(value,false,'next');
|
|
713
|
+
return this.check(value,pass,'iterator');
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
asyncIterator(value){
|
|
717
|
+
const symbol=Symbol.asyncIterator;
|
|
718
|
+
const pass=value !== null && value !== undefined && protocolCheck(value,false,'next') && typeof symbol === 'symbol' && protocolCheck(value,symbol);
|
|
719
|
+
return this.check(value,pass,'async iterator');
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
iterable(value){
|
|
723
|
+
return this.check(value,protocolCheck(value,Symbol.iterator),'iterable');
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
asyncIterable(value){
|
|
727
|
+
return this.check(value,protocolCheck(value,Symbol.asyncIterator),'async iterable');
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
//errors
|
|
731
|
+
error(value){
|
|
732
|
+
return this.instanceCheck(value,Error);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
aggregateError(value){
|
|
736
|
+
return this.globalInstanceCheck(value,'AggregateError');
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
evalError(value){
|
|
740
|
+
return this.instanceCheck(value,EvalError);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
rangeError(value){
|
|
744
|
+
return this.instanceCheck(value,RangeError);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
referenceError(value){
|
|
748
|
+
return this.instanceCheck(value,ReferenceError);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
syntaxError(value){
|
|
752
|
+
return this.instanceCheck(value,SyntaxError);
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
typeError(value){
|
|
756
|
+
return this.instanceCheck(value,TypeError);
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
URIError(value){
|
|
760
|
+
return this.instanceCheck(value,URIError);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
uriError(value){
|
|
764
|
+
return this.URIError(value);
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
suppressedError(value){
|
|
768
|
+
return this.globalInstanceCheck(value,'SuppressedError');
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
//typed arrays
|
|
772
|
+
typedArray(value){
|
|
773
|
+
return this.check(value,Boolean(typedArrayName(value)),'typed array');
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
arrayBufferView(value){
|
|
777
|
+
return this.check(value,arrayBufferViewCheck(value),'ArrayBuffer view');
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
bigInt64Array(value){
|
|
781
|
+
return this.check(value,typedArrayName(value) === 'BigInt64Array','BigInt64Array');
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
bigUint64Array(value){
|
|
785
|
+
return this.check(value,typedArrayName(value) === 'BigUint64Array','BigUint64Array');
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
float16Array(value){
|
|
789
|
+
return this.check(value,typedArrayName(value) === 'Float16Array','Float16Array');
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
float32Array(value){
|
|
793
|
+
return this.check(value,typedArrayName(value) === 'Float32Array','Float32Array');
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
float64Array(value){
|
|
797
|
+
return this.check(value,typedArrayName(value) === 'Float64Array','Float64Array');
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
int8Array(value){
|
|
801
|
+
return this.check(value,typedArrayName(value) === 'Int8Array','Int8Array');
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
int16Array(value){
|
|
805
|
+
return this.check(value,typedArrayName(value) === 'Int16Array','Int16Array');
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
int32Array(value){
|
|
809
|
+
return this.check(value,typedArrayName(value) === 'Int32Array','Int32Array');
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
uint8Array(value){
|
|
813
|
+
return this.check(value,typedArrayName(value) === 'Uint8Array','Uint8Array');
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
uint8ClampedArray(value){
|
|
817
|
+
return this.check(value,typedArrayName(value) === 'Uint8ClampedArray','Uint8ClampedArray');
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
uint16Array(value){
|
|
821
|
+
return this.check(value,typedArrayName(value) === 'Uint16Array','Uint16Array');
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
uint32Array(value){
|
|
825
|
+
return this.check(value,typedArrayName(value) === 'Uint32Array','Uint32Array');
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
//buffers
|
|
829
|
+
arrayBuffer(value){
|
|
830
|
+
return this.check(value,arrayBufferCheck(value),'ArrayBuffer');
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
sharedArrayBuffer(value){
|
|
834
|
+
return this.check(value,sharedArrayBufferCheck(value),'SharedArrayBuffer');
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
anyArrayBuffer(value){
|
|
838
|
+
return this.check(value,arrayBufferCheck(value) || sharedArrayBufferCheck(value),'ArrayBuffer or SharedArrayBuffer');
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
dataView(value){
|
|
842
|
+
return this.check(value,dataViewCheck(value),'DataView');
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
resizableArrayBuffer(value){
|
|
846
|
+
const pass=applyValue(value,arrayBufferResizableGetter) === true;
|
|
847
|
+
return this.check(value,pass,'resizable ArrayBuffer');
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
growableSharedArrayBuffer(value){
|
|
851
|
+
const pass=applyValue(value,sharedArrayBufferGrowableGetter) === true;
|
|
852
|
+
return this.check(value,pass,'growable SharedArrayBuffer');
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
detachedArrayBuffer(value){
|
|
856
|
+
if(!arrayBufferCheck(value)){
|
|
857
|
+
return this.check(value,false,'detached ArrayBuffer');
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
const prototype=globalThis.ArrayBuffer.prototype;
|
|
861
|
+
const descriptor=Object.getOwnPropertyDescriptor(prototype,'detached');
|
|
862
|
+
if(descriptor && typeof descriptor.get === 'function'){
|
|
863
|
+
return this.check(value,reflectApply(descriptor.get,value,noArguments) === true,'detached ArrayBuffer');
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
let detached=false;
|
|
867
|
+
try{
|
|
868
|
+
new DataView(value);
|
|
869
|
+
}catch(err){
|
|
870
|
+
detached=true;
|
|
871
|
+
}
|
|
872
|
+
return this.check(value,detached,'detached ArrayBuffer');
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
//Intl
|
|
876
|
+
intlDateTimeFormat(value){
|
|
877
|
+
const constructor=globalThis.Intl && globalThis.Intl.DateTimeFormat;
|
|
878
|
+
const pass=constructor && applyBrand(value,intlDateTimeFormatGetter);
|
|
879
|
+
return this.check(value,pass,'Intl.DateTimeFormat');
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
intlCollator(value){
|
|
883
|
+
const constructor=globalThis.Intl && globalThis.Intl.Collator;
|
|
884
|
+
const pass=constructor && applyBrand(value,intlCollatorCompareGetter);
|
|
885
|
+
return this.check(value,pass,'Intl.Collator');
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
intlDisplayNames(value){
|
|
889
|
+
const constructor=globalThis.Intl && globalThis.Intl.DisplayNames;
|
|
890
|
+
const pass=constructor && methodBrand(value,constructor.prototype,'resolvedOptions');
|
|
891
|
+
return this.check(value,pass,'Intl.DisplayNames');
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
intlListFormat(value){
|
|
895
|
+
const constructor=globalThis.Intl && globalThis.Intl.ListFormat;
|
|
896
|
+
const pass=constructor && methodBrand(value,constructor.prototype,'resolvedOptions');
|
|
897
|
+
return this.check(value,pass,'Intl.ListFormat');
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
intlLocale(value){
|
|
901
|
+
const constructor=globalThis.Intl && globalThis.Intl.Locale;
|
|
902
|
+
const pass=constructor && getterBrand(value,constructor.prototype,'baseName');
|
|
903
|
+
return this.check(value,pass,'Intl.Locale');
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
intlNumberFormat(value){
|
|
907
|
+
const constructor=globalThis.Intl && globalThis.Intl.NumberFormat;
|
|
908
|
+
const pass=constructor && applyBrand(value,intlNumberFormatGetter);
|
|
909
|
+
return this.check(value,pass,'Intl.NumberFormat');
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
intlPluralRules(value){
|
|
913
|
+
const constructor=globalThis.Intl && globalThis.Intl.PluralRules;
|
|
914
|
+
const pass=constructor && methodBrand(value,constructor.prototype,'resolvedOptions');
|
|
915
|
+
return this.check(value,pass,'Intl.PluralRules');
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
intlRelativeTimeFormat(value){
|
|
919
|
+
const constructor=globalThis.Intl && globalThis.Intl.RelativeTimeFormat;
|
|
920
|
+
const pass=constructor && methodBrand(value,constructor.prototype,'resolvedOptions');
|
|
921
|
+
return this.check(value,pass,'Intl.RelativeTimeFormat');
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
intlSegmenter(value){
|
|
925
|
+
const constructor=globalThis.Intl && globalThis.Intl.Segmenter;
|
|
926
|
+
const pass=constructor && methodBrand(value,constructor.prototype,'resolvedOptions');
|
|
927
|
+
return this.check(value,pass,'Intl.Segmenter');
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
intlSegments(value){
|
|
931
|
+
const constructor=globalThis.Intl && globalThis.Intl.Segmenter;
|
|
932
|
+
const pass=applyBrand(value,segmentsContainingFor(constructor),segmentProbeArguments);
|
|
933
|
+
return this.check(value,pass,'Intl Segments');
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
intlDurationFormat(value){
|
|
937
|
+
const constructor=globalThis.Intl && globalThis.Intl.DurationFormat;
|
|
938
|
+
const pass=constructor && methodBrand(value,constructor.prototype,'resolvedOptions');
|
|
939
|
+
return this.check(value,pass,'Intl.DurationFormat');
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
//garbage collection and resource management
|
|
943
|
+
finalizationRegistry(value){
|
|
944
|
+
const constructor=globalThis.FinalizationRegistry;
|
|
945
|
+
const pass=constructor && methodBrand(value,constructor.prototype,'unregister',brandProbeArguments);
|
|
946
|
+
return this.check(value,pass,'FinalizationRegistry');
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
weakRef(value){
|
|
950
|
+
const constructor=globalThis.WeakRef;
|
|
951
|
+
const pass=constructor && methodBrand(value,constructor.prototype,'deref');
|
|
952
|
+
return this.check(value,pass,'WeakRef');
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
disposable(value){
|
|
956
|
+
const symbol=Symbol.dispose;
|
|
957
|
+
return this.check(value,typeof symbol === 'symbol' && protocolCheck(value,symbol),'disposable');
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
asyncDisposable(value){
|
|
961
|
+
const symbol=Symbol.asyncDispose;
|
|
962
|
+
return this.check(value,typeof symbol === 'symbol' && protocolCheck(value,symbol),'async disposable');
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
disposableStack(value){
|
|
966
|
+
return this.globalInstanceCheck(value,'DisposableStack');
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
asyncDisposableStack(value){
|
|
970
|
+
return this.globalInstanceCheck(value,'AsyncDisposableStack');
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
//Temporal
|
|
974
|
+
temporalDuration(value){
|
|
975
|
+
return this.nestedInstanceCheck(value,globalThis.Temporal,'Duration');
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
temporalInstant(value){
|
|
979
|
+
return this.nestedInstanceCheck(value,globalThis.Temporal,'Instant');
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
temporalPlainDate(value){
|
|
983
|
+
return this.nestedInstanceCheck(value,globalThis.Temporal,'PlainDate');
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
temporalPlainDateTime(value){
|
|
987
|
+
return this.nestedInstanceCheck(value,globalThis.Temporal,'PlainDateTime');
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
temporalPlainMonthDay(value){
|
|
991
|
+
return this.nestedInstanceCheck(value,globalThis.Temporal,'PlainMonthDay');
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
temporalPlainTime(value){
|
|
995
|
+
return this.nestedInstanceCheck(value,globalThis.Temporal,'PlainTime');
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
temporalPlainYearMonth(value){
|
|
999
|
+
return this.nestedInstanceCheck(value,globalThis.Temporal,'PlainYearMonth');
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
temporalZonedDateTime(value){
|
|
1003
|
+
return this.nestedInstanceCheck(value,globalThis.Temporal,'ZonedDateTime');
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
//URL and text
|
|
1007
|
+
url(value){
|
|
1008
|
+
return this.globalInstanceCheck(value,'URL');
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
urlSearchParams(value){
|
|
1012
|
+
return this.globalInstanceCheck(value,'URLSearchParams');
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
urlPattern(value){
|
|
1016
|
+
return this.globalInstanceCheck(value,'URLPattern');
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
textEncoder(value){
|
|
1020
|
+
return this.globalInstanceCheck(value,'TextEncoder');
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
textDecoder(value){
|
|
1024
|
+
return this.globalInstanceCheck(value,'TextDecoder');
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
textEncoderStream(value){
|
|
1028
|
+
return this.globalInstanceCheck(value,'TextEncoderStream');
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
textDecoderStream(value){
|
|
1032
|
+
return this.globalInstanceCheck(value,'TextDecoderStream');
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
//fetch and data
|
|
1036
|
+
domException(value){
|
|
1037
|
+
return this.globalInstanceCheck(value,'DOMException');
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
blob(value){
|
|
1041
|
+
return this.globalInstanceCheck(value,'Blob');
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
file(value){
|
|
1045
|
+
return this.globalInstanceCheck(value,'File');
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
formData(value){
|
|
1049
|
+
return this.globalInstanceCheck(value,'FormData');
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
headers(value){
|
|
1053
|
+
return this.globalInstanceCheck(value,'Headers');
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
request(value){
|
|
1057
|
+
return this.globalInstanceCheck(value,'Request');
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
response(value){
|
|
1061
|
+
return this.globalInstanceCheck(value,'Response');
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
//events and messaging
|
|
1065
|
+
abortController(value){
|
|
1066
|
+
return this.globalInstanceCheck(value,'AbortController');
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
abortSignal(value){
|
|
1070
|
+
return this.globalInstanceCheck(value,'AbortSignal');
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
event(value){
|
|
1074
|
+
return this.globalInstanceCheck(value,'Event');
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
eventTarget(value){
|
|
1078
|
+
return this.globalInstanceCheck(value,'EventTarget');
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
customEvent(value){
|
|
1082
|
+
return this.globalInstanceCheck(value,'CustomEvent');
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
messageEvent(value){
|
|
1086
|
+
return this.globalInstanceCheck(value,'MessageEvent');
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
closeEvent(value){
|
|
1090
|
+
return this.globalInstanceCheck(value,'CloseEvent');
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
errorEvent(value){
|
|
1094
|
+
return this.globalInstanceCheck(value,'ErrorEvent');
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
broadcastChannel(value){
|
|
1098
|
+
return this.globalInstanceCheck(value,'BroadcastChannel');
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
messageChannel(value){
|
|
1102
|
+
return this.globalInstanceCheck(value,'MessageChannel');
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
messagePort(value){
|
|
1106
|
+
return this.globalInstanceCheck(value,'MessagePort');
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
webSocket(value){
|
|
1110
|
+
return this.globalInstanceCheck(value,'WebSocket');
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
eventSource(value){
|
|
1114
|
+
return this.globalInstanceCheck(value,'EventSource');
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
navigator(value){
|
|
1118
|
+
return this.globalValueCheck(value,'navigator');
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
storage(value){
|
|
1122
|
+
return this.globalInstanceCheck(value,'Storage');
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
//streams
|
|
1126
|
+
readableStream(value){
|
|
1127
|
+
return this.globalInstanceCheck(value,'ReadableStream');
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
readableStreamDefaultReader(value){
|
|
1131
|
+
return this.globalInstanceCheck(value,'ReadableStreamDefaultReader');
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
readableStreamBYOBReader(value){
|
|
1135
|
+
return this.globalInstanceCheck(value,'ReadableStreamBYOBReader');
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
readableStreamDefaultController(value){
|
|
1139
|
+
return this.globalInstanceCheck(value,'ReadableStreamDefaultController');
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
readableByteStreamController(value){
|
|
1143
|
+
return this.globalInstanceCheck(value,'ReadableByteStreamController');
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
readableStreamBYOBRequest(value){
|
|
1147
|
+
return this.globalInstanceCheck(value,'ReadableStreamBYOBRequest');
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
writableStream(value){
|
|
1151
|
+
return this.globalInstanceCheck(value,'WritableStream');
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
writableStreamDefaultWriter(value){
|
|
1155
|
+
return this.globalInstanceCheck(value,'WritableStreamDefaultWriter');
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
writableStreamDefaultController(value){
|
|
1159
|
+
return this.globalInstanceCheck(value,'WritableStreamDefaultController');
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
transformStream(value){
|
|
1163
|
+
return this.globalInstanceCheck(value,'TransformStream');
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
transformStreamDefaultController(value){
|
|
1167
|
+
return this.globalInstanceCheck(value,'TransformStreamDefaultController');
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
byteLengthQueuingStrategy(value){
|
|
1171
|
+
return this.globalInstanceCheck(value,'ByteLengthQueuingStrategy');
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
countQueuingStrategy(value){
|
|
1175
|
+
return this.globalInstanceCheck(value,'CountQueuingStrategy');
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
compressionStream(value){
|
|
1179
|
+
return this.globalInstanceCheck(value,'CompressionStream');
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
decompressionStream(value){
|
|
1183
|
+
return this.globalInstanceCheck(value,'DecompressionStream');
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
//crypto and performance
|
|
1187
|
+
crypto(value){
|
|
1188
|
+
return this.globalValueCheck(value,'crypto');
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
subtleCrypto(value){
|
|
1192
|
+
const crypto=globalThis.crypto;
|
|
1193
|
+
return this.check(value,crypto && Object.is(value,crypto.subtle),'SubtleCrypto');
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
cryptoKey(value){
|
|
1197
|
+
return this.globalInstanceCheck(value,'CryptoKey');
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
performance(value){
|
|
1201
|
+
return this.globalValueCheck(value,'performance');
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
performanceEntry(value){
|
|
1205
|
+
return this.globalInstanceCheck(value,'PerformanceEntry');
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
performanceMark(value){
|
|
1209
|
+
const constructor=globalThis.PerformanceMark;
|
|
1210
|
+
const pass=typeof constructor === 'function' ? instanceOf(value,constructor) : stringTagCheck(value,'PerformanceMark');
|
|
1211
|
+
return this.check(value,pass,'PerformanceMark');
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
performanceMeasure(value){
|
|
1215
|
+
const constructor=globalThis.PerformanceMeasure;
|
|
1216
|
+
const pass=typeof constructor === 'function' ? instanceOf(value,constructor) : stringTagCheck(value,'PerformanceMeasure');
|
|
1217
|
+
return this.check(value,pass,'PerformanceMeasure');
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
performanceObserver(value){
|
|
1221
|
+
return this.globalInstanceCheck(value,'PerformanceObserver');
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
performanceObserverEntryList(value){
|
|
1225
|
+
return this.globalInstanceCheck(value,'PerformanceObserverEntryList');
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
performanceResourceTiming(value){
|
|
1229
|
+
return this.globalInstanceCheck(value,'PerformanceResourceTiming');
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
//WebAssembly
|
|
1233
|
+
webAssemblyModule(value){
|
|
1234
|
+
return this.nestedInstanceCheck(value,globalThis.WebAssembly,'Module');
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
webAssemblyInstance(value){
|
|
1238
|
+
return this.nestedInstanceCheck(value,globalThis.WebAssembly,'Instance');
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
webAssemblyMemory(value){
|
|
1242
|
+
return this.nestedInstanceCheck(value,globalThis.WebAssembly,'Memory');
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
webAssemblyTable(value){
|
|
1246
|
+
return this.nestedInstanceCheck(value,globalThis.WebAssembly,'Table');
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
webAssemblyGlobal(value){
|
|
1250
|
+
return this.nestedInstanceCheck(value,globalThis.WebAssembly,'Global');
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
webAssemblyTag(value){
|
|
1254
|
+
return this.nestedInstanceCheck(value,globalThis.WebAssembly,'Tag');
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
webAssemblyException(value){
|
|
1258
|
+
return this.nestedInstanceCheck(value,globalThis.WebAssembly,'Exception');
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
webAssemblyCompileError(value){
|
|
1262
|
+
return this.nestedInstanceCheck(value,globalThis.WebAssembly,'CompileError');
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
webAssemblyLinkError(value){
|
|
1266
|
+
return this.nestedInstanceCheck(value,globalThis.WebAssembly,'LinkError');
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
webAssemblyRuntimeError(value){
|
|
1270
|
+
return this.nestedInstanceCheck(value,globalThis.WebAssembly,'RuntimeError');
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
const defaultThrow=Is.prototype.throw;
|
|
1275
|
+
|
|
1276
|
+
export {Is as default,Is};
|