summaryrefslogtreecommitdiff
path: root/op_crates/fetch/01_fetch_util.js
diff options
context:
space:
mode:
Diffstat (limited to 'op_crates/fetch/01_fetch_util.js')
-rw-r--r--op_crates/fetch/01_fetch_util.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/op_crates/fetch/01_fetch_util.js b/op_crates/fetch/01_fetch_util.js
new file mode 100644
index 000000000..07f45d821
--- /dev/null
+++ b/op_crates/fetch/01_fetch_util.js
@@ -0,0 +1,20 @@
+// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
+
+((window) => {
+ function requiredArguments(
+ name,
+ length,
+ required,
+ ) {
+ if (length < required) {
+ const errMsg = `${name} requires at least ${required} argument${
+ required === 1 ? "" : "s"
+ }, but only ${length} present`;
+ throw new TypeError(errMsg);
+ }
+ }
+
+ window.__bootstrap.fetchUtil = {
+ requiredArguments,
+ };
+})(this);