summaryrefslogtreecommitdiff
path: root/js/fetch.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-04-21 16:40:10 -0400
committerGitHub <noreply@github.com>2019-04-21 16:40:10 -0400
commit9dfebbc9496138efbeedc431068f41662c780f3e (patch)
treec3718c3dc132d11c08c8fc18933daebf886bf787 /js/fetch.ts
parent6cded14bdf313762956d4d5361cfe8115628b535 (diff)
Fix eslint warnings (#2151)
Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com> Co-authored-by: LE GOFF Vincent <g_n_s@hotmail.fr>
Diffstat (limited to 'js/fetch.ts')
-rw-r--r--js/fetch.ts32
1 files changed, 17 insertions, 15 deletions
diff --git a/js/fetch.ts b/js/fetch.ts
index 7cc0750ed..3489c54a0 100644
--- a/js/fetch.ts
+++ b/js/fetch.ts
@@ -19,10 +19,10 @@ function getHeaderValueParams(value: string): Map<string, string> {
value
.split(";")
.slice(1)
- .map(s => s.trim().split("="))
- .filter(arr => arr.length > 1)
- .map(([k, v]) => [k, v.replace(/^"([^"]*)"$/, "$1")])
- .forEach(([k, v]) => params.set(k, v));
+ .map((s): string[] => s.trim().split("="))
+ .filter((arr): boolean => arr.length > 1)
+ .map(([k, v]): [string, string] => [k, v.replace(/^"([^"]*)"$/, "$1")])
+ .forEach(([k, v]): Map<string, string> => params.set(k, v));
return params;
}
@@ -116,7 +116,7 @@ class Body implements domTypes.Body, domTypes.ReadableStream, io.ReadCloser {
// (as long as it is not part of `delimiter`)
bodyParts = bodyPreambleTrimmed
.split(delimiter)
- .map(s => s.replace(/^[\s\r\n\t]+/, ""));
+ .map((s): string => s.replace(/^[\s\r\n\t]+/, ""));
// TODO: LWSP definition is actually trickier,
// but should be fine in our case since without headers
// we should just discard the part
@@ -184,17 +184,19 @@ class Body implements domTypes.Body, domTypes.ReadableStream, io.ReadCloser {
body
.trim()
.split("&")
- .forEach(bytes => {
- if (bytes) {
- const split = bytes.split("=");
- const name = split.shift()!.replace(/\+/g, " ");
- const value = split.join("=").replace(/\+/g, " ");
- formData.append(
- decodeURIComponent(name),
- decodeURIComponent(value)
- );
+ .forEach(
+ (bytes): void => {
+ if (bytes) {
+ const split = bytes.split("=");
+ const name = split.shift()!.replace(/\+/g, " ");
+ const value = split.join("=").replace(/\+/g, " ");
+ formData.append(
+ decodeURIComponent(name),
+ decodeURIComponent(value)
+ );
+ }
}
- });
+ );
} catch (e) {
throw new TypeError("Invalid form urlencoded format");
}