diff options
Diffstat (limited to 'ext/fetch/01_fetch_util.js')
-rw-r--r-- | ext/fetch/01_fetch_util.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/fetch/01_fetch_util.js b/ext/fetch/01_fetch_util.js new file mode 100644 index 000000000..9cf19588b --- /dev/null +++ b/ext/fetch/01_fetch_util.js @@ -0,0 +1,22 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +"use strict"; + +((window) => { + const { TypeError } = window.__bootstrap.primordials; + 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); |