summaryrefslogtreecommitdiff
path: root/op_crates/fetch/01_fetch_util.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-09-18 15:20:55 +0200
committerGitHub <noreply@github.com>2020-09-18 09:20:55 -0400
commit7845740637eb646c0b13dc541f043fd65136fc03 (patch)
tree8576a376d72ffdfe4ffed983a2bed9e605d20e8b /op_crates/fetch/01_fetch_util.js
parentcead79f5b8ffd376d339b6e0c30e872bfe6820f6 (diff)
refactor: deno_fetch op crate (#7524)
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);