Fix calling tools JS
This commit is contained in:
parent
5f0080a7d7
commit
29eb07c159
23 changed files with 27 additions and 23 deletions
19
js/calling-tools/assert.js
Normal file
19
js/calling-tools/assert.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Derived from Chromium WebRTC Internals Dashboard - see Acknowledgements for full license details
|
||||
export function assert(value, message) {
|
||||
if (value) {
|
||||
return;
|
||||
}
|
||||
throw new Error("Assertion failed" + (message ? `: ${message}` : ""));
|
||||
}
|
||||
export function assertInstanceof(value, type, message) {
|
||||
if (value instanceof type) {
|
||||
return;
|
||||
}
|
||||
throw new Error(
|
||||
message || `Value ${value} is not of type ${type.name || typeof type}`,
|
||||
);
|
||||
}
|
||||
export function assertNotReached(message = "Unreachable code hit") {
|
||||
assert(false, message);
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue