rekwest 3.3.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils.js +1 -1
- package/package.json +5 -2
- package/src/formdata.mjs +239 -239
- package/src/utils.mjs +1 -1
package/dist/utils.js
CHANGED
|
@@ -95,7 +95,7 @@ const affix = (client, req, options) => {
|
|
|
95
95
|
exports.affix = affix;
|
|
96
96
|
|
|
97
97
|
const collate = (entity, primordial) => {
|
|
98
|
-
if (
|
|
98
|
+
if (entity?.constructor !== primordial) {
|
|
99
99
|
throw new TypeError('Illegal invocation');
|
|
100
100
|
}
|
|
101
101
|
};
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@babel/eslint-parser": "^7.17.0",
|
|
14
14
|
"@babel/preset-env": "^7.17.10",
|
|
15
15
|
"c8": "^7.11.2",
|
|
16
|
-
"eslint": "^8.
|
|
16
|
+
"eslint": "^8.15.0",
|
|
17
17
|
"eslint-config-ultra-refined": "^2.5.0",
|
|
18
18
|
"mocha": "^10.0.0"
|
|
19
19
|
},
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
"homepage": "https://github.com/bricss/rekwest#readme",
|
|
33
33
|
"keywords": [
|
|
34
34
|
"backoff",
|
|
35
|
+
"compression",
|
|
36
|
+
"cookie",
|
|
35
37
|
"fetch",
|
|
36
38
|
"fetch-alike",
|
|
37
39
|
"formdata",
|
|
@@ -42,6 +44,7 @@
|
|
|
42
44
|
"http2",
|
|
43
45
|
"multipart",
|
|
44
46
|
"request",
|
|
47
|
+
"redirect",
|
|
45
48
|
"retry"
|
|
46
49
|
],
|
|
47
50
|
"license": "MIT",
|
|
@@ -62,5 +65,5 @@
|
|
|
62
65
|
"test:bail": "mocha --bail",
|
|
63
66
|
"test:cover": "c8 --include=src --reporter=lcov --reporter=text npm test"
|
|
64
67
|
},
|
|
65
|
-
"version": "3.3.
|
|
68
|
+
"version": "3.3.1"
|
|
66
69
|
}
|
package/src/formdata.mjs
CHANGED
|
@@ -1,239 +1,239 @@
|
|
|
1
|
-
import { randomBytes } from 'node:crypto';
|
|
2
|
-
import http2 from 'node:http2';
|
|
3
|
-
import { toUSVString } from 'node:util';
|
|
4
|
-
import { File } from './file.mjs';
|
|
5
|
-
import {
|
|
6
|
-
APPLICATION_OCTET_STREAM,
|
|
7
|
-
MULTIPART_FORM_DATA,
|
|
8
|
-
} from './mediatypes.mjs';
|
|
9
|
-
import {
|
|
10
|
-
collate,
|
|
11
|
-
tap,
|
|
12
|
-
} from './utils.mjs';
|
|
13
|
-
|
|
14
|
-
const CRLF = '\r\n';
|
|
15
|
-
const {
|
|
16
|
-
HTTP2_HEADER_CONTENT_DISPOSITION,
|
|
17
|
-
HTTP2_HEADER_CONTENT_TYPE,
|
|
18
|
-
} = http2.constants;
|
|
19
|
-
|
|
20
|
-
export class FormData {
|
|
21
|
-
|
|
22
|
-
static actuate(fd) {
|
|
23
|
-
const boundary = randomBytes(24).toString('hex');
|
|
24
|
-
const contentType = `${ MULTIPART_FORM_DATA }; boundary=${ boundary }`;
|
|
25
|
-
const prefix = `--${ boundary }${ CRLF }${ HTTP2_HEADER_CONTENT_DISPOSITION }: form-data`;
|
|
26
|
-
|
|
27
|
-
const escape = (str) => str.replace(/\n/g, '%0A').replace(/\r/g, '%0D').replace(/"/g, '%22');
|
|
28
|
-
const normalize = (value) => value.replace(/\r?\n|\r/g, CRLF);
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
contentType,
|
|
32
|
-
async* [Symbol.asyncIterator]() {
|
|
33
|
-
const encoder = new TextEncoder();
|
|
34
|
-
|
|
35
|
-
for (const [name, value] of fd) {
|
|
36
|
-
if (value.constructor === String) {
|
|
37
|
-
yield encoder.encode(`${ prefix }; name="${
|
|
38
|
-
escape(normalize(name))
|
|
39
|
-
}"${ CRLF.repeat(2) }${ normalize(value) }${ CRLF }`);
|
|
40
|
-
} else {
|
|
41
|
-
yield encoder.encode(`${ prefix }; name="${
|
|
42
|
-
escape(normalize(name))
|
|
43
|
-
}"${ value.name ? `; filename="${ escape(value.name) }"` : '' }${ CRLF }${
|
|
44
|
-
HTTP2_HEADER_CONTENT_TYPE
|
|
45
|
-
}: ${
|
|
46
|
-
value.type || APPLICATION_OCTET_STREAM
|
|
47
|
-
}${ CRLF.repeat(2) }`);
|
|
48
|
-
yield* tap(value);
|
|
49
|
-
yield encoder.encode(CRLF);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
yield encoder.encode(`--${ boundary }--`);
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
static alike(instance) {
|
|
59
|
-
return instance?.constructor.name === FormData.name;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
static #enfoldEntry(name, value, filename) {
|
|
63
|
-
name = toUSVString(name);
|
|
64
|
-
filename &&= toUSVString(filename);
|
|
65
|
-
|
|
66
|
-
if (File.alike(value)) {
|
|
67
|
-
value = new File([value], filename, value);
|
|
68
|
-
} else if (this.#ensureInstance(value)) {
|
|
69
|
-
value.name = filename || value.name;
|
|
70
|
-
} else {
|
|
71
|
-
value = toUSVString(value);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
name,
|
|
76
|
-
value,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
static #ensureInstance(value) {
|
|
81
|
-
return File.alike(value) || (value === Object(value) && Reflect.has(value, Symbol.asyncIterator));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
#entries = [];
|
|
85
|
-
|
|
86
|
-
get [Symbol.toStringTag]() {
|
|
87
|
-
return this.constructor.name;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
constructor(input) {
|
|
91
|
-
if (input === Object(input)
|
|
92
|
-
&& (input?.constructor === Object || Reflect.has(input, Symbol.iterator))) {
|
|
93
|
-
|
|
94
|
-
if (input.constructor !== Object) {
|
|
95
|
-
input = Array.from(input);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (Array.isArray(input)) {
|
|
99
|
-
if (!input.every((it) => Array.isArray(it))) {
|
|
100
|
-
throw new TypeError(`Failed to construct '${
|
|
101
|
-
this[Symbol.toStringTag]
|
|
102
|
-
}': The provided value cannot be converted to a sequence.`);
|
|
103
|
-
} else if (!input.every((it) => it.length === 2)) {
|
|
104
|
-
throw new TypeError(`Failed to construct '${
|
|
105
|
-
this[Symbol.toStringTag]
|
|
106
|
-
}': Sequence initializer must only contain pair elements.`);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (input.constructor === Object) {
|
|
111
|
-
input = Object.entries(input);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
input.forEach(([key, value]) => this.append(key, value));
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
#ensureArgs(args, expected, method) {
|
|
119
|
-
if (args.length < expected) {
|
|
120
|
-
throw new TypeError(`Failed to execute '${ method }' on '${
|
|
121
|
-
this[Symbol.toStringTag]
|
|
122
|
-
}': ${ expected } arguments required, but only ${ args.length } present.`);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if ([
|
|
126
|
-
'append',
|
|
127
|
-
'set',
|
|
128
|
-
].includes(method)) {
|
|
129
|
-
if (args.length === 3 && !this.constructor.#ensureInstance(args[1])) {
|
|
130
|
-
throw new TypeError(`Failed to execute '${ method }' on '${
|
|
131
|
-
this[Symbol.toStringTag]
|
|
132
|
-
}': parameter ${ expected } is not of type 'Blob', 'File' or async iterable.`);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (method === 'forEach') {
|
|
137
|
-
if (args[0]?.constructor !== Function) {
|
|
138
|
-
throw new TypeError(`Failed to execute '${ method }' on '${
|
|
139
|
-
this[Symbol.toStringTag]
|
|
140
|
-
}': parameter ${ expected } is not of type 'Function'.`);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
append(...args) {
|
|
146
|
-
collate(this, FormData);
|
|
147
|
-
this.#ensureArgs(args, 2, 'append');
|
|
148
|
-
this.#entries.push(this.constructor.#enfoldEntry(...args));
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
delete(...args) {
|
|
152
|
-
collate(this, FormData);
|
|
153
|
-
this.#ensureArgs(args, 1, 'delete');
|
|
154
|
-
const name = toUSVString(args[0]);
|
|
155
|
-
|
|
156
|
-
this.#entries = this.#entries.filter((it) => it.name !== name);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
forEach(...args) {
|
|
160
|
-
collate(this, FormData);
|
|
161
|
-
this.#ensureArgs(args, 1, 'forEach');
|
|
162
|
-
const [callback, thisArg] = args;
|
|
163
|
-
|
|
164
|
-
for (const entry of this) {
|
|
165
|
-
Reflect.apply(callback, thisArg, [
|
|
166
|
-
...entry.reverse(),
|
|
167
|
-
this,
|
|
168
|
-
]);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
get(...args) {
|
|
173
|
-
collate(this, FormData);
|
|
174
|
-
this.#ensureArgs(args, 1, 'get');
|
|
175
|
-
const name = toUSVString(args[0]);
|
|
176
|
-
|
|
177
|
-
return (this.#entries.find((it) => it.name === name) ?? {}).value ?? null;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
getAll(...args) {
|
|
181
|
-
collate(this, FormData);
|
|
182
|
-
this.#ensureArgs(args, 1, 'getAll');
|
|
183
|
-
const name = toUSVString(args[0]);
|
|
184
|
-
|
|
185
|
-
return this.#entries.filter((it) => it.name === name).map((it) => it.value);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
has(...args) {
|
|
189
|
-
collate(this, FormData);
|
|
190
|
-
this.#ensureArgs(args, 1, 'has');
|
|
191
|
-
const name = toUSVString(args[0]);
|
|
192
|
-
|
|
193
|
-
return !!this.#entries.find((it) => it.name === name);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
set(...args) {
|
|
197
|
-
collate(this, FormData);
|
|
198
|
-
this.#ensureArgs(args, 2, 'set');
|
|
199
|
-
const entry = this.constructor.#enfoldEntry(...args);
|
|
200
|
-
const idx = this.#entries.findIndex((it) => it.name === entry.name);
|
|
201
|
-
|
|
202
|
-
if (idx !== -1) {
|
|
203
|
-
this.#entries.splice(idx, 1, entry);
|
|
204
|
-
} else {
|
|
205
|
-
this.#entries.push(entry);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
* entries() {
|
|
210
|
-
collate(this, FormData);
|
|
211
|
-
for (const { name, value } of this.#entries) {
|
|
212
|
-
yield [
|
|
213
|
-
name,
|
|
214
|
-
value,
|
|
215
|
-
];
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
* keys() {
|
|
220
|
-
collate(this, FormData);
|
|
221
|
-
for (const [name] of this) {
|
|
222
|
-
yield name;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
* values() {
|
|
227
|
-
collate(this, FormData);
|
|
228
|
-
for (const [, value] of this) {
|
|
229
|
-
yield value;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
[Symbol.iterator]() {
|
|
234
|
-
collate(this, FormData);
|
|
235
|
-
|
|
236
|
-
return this.entries();
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
}
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import http2 from 'node:http2';
|
|
3
|
+
import { toUSVString } from 'node:util';
|
|
4
|
+
import { File } from './file.mjs';
|
|
5
|
+
import {
|
|
6
|
+
APPLICATION_OCTET_STREAM,
|
|
7
|
+
MULTIPART_FORM_DATA,
|
|
8
|
+
} from './mediatypes.mjs';
|
|
9
|
+
import {
|
|
10
|
+
collate,
|
|
11
|
+
tap,
|
|
12
|
+
} from './utils.mjs';
|
|
13
|
+
|
|
14
|
+
const CRLF = '\r\n';
|
|
15
|
+
const {
|
|
16
|
+
HTTP2_HEADER_CONTENT_DISPOSITION,
|
|
17
|
+
HTTP2_HEADER_CONTENT_TYPE,
|
|
18
|
+
} = http2.constants;
|
|
19
|
+
|
|
20
|
+
export class FormData {
|
|
21
|
+
|
|
22
|
+
static actuate(fd) {
|
|
23
|
+
const boundary = randomBytes(24).toString('hex');
|
|
24
|
+
const contentType = `${ MULTIPART_FORM_DATA }; boundary=${ boundary }`;
|
|
25
|
+
const prefix = `--${ boundary }${ CRLF }${ HTTP2_HEADER_CONTENT_DISPOSITION }: form-data`;
|
|
26
|
+
|
|
27
|
+
const escape = (str) => str.replace(/\n/g, '%0A').replace(/\r/g, '%0D').replace(/"/g, '%22');
|
|
28
|
+
const normalize = (value) => value.replace(/\r?\n|\r/g, CRLF);
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
contentType,
|
|
32
|
+
async* [Symbol.asyncIterator]() {
|
|
33
|
+
const encoder = new TextEncoder();
|
|
34
|
+
|
|
35
|
+
for (const [name, value] of fd) {
|
|
36
|
+
if (value.constructor === String) {
|
|
37
|
+
yield encoder.encode(`${ prefix }; name="${
|
|
38
|
+
escape(normalize(name))
|
|
39
|
+
}"${ CRLF.repeat(2) }${ normalize(value) }${ CRLF }`);
|
|
40
|
+
} else {
|
|
41
|
+
yield encoder.encode(`${ prefix }; name="${
|
|
42
|
+
escape(normalize(name))
|
|
43
|
+
}"${ value.name ? `; filename="${ escape(value.name) }"` : '' }${ CRLF }${
|
|
44
|
+
HTTP2_HEADER_CONTENT_TYPE
|
|
45
|
+
}: ${
|
|
46
|
+
value.type || APPLICATION_OCTET_STREAM
|
|
47
|
+
}${ CRLF.repeat(2) }`);
|
|
48
|
+
yield* tap(value);
|
|
49
|
+
yield encoder.encode(CRLF);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
yield encoder.encode(`--${ boundary }--`);
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static alike(instance) {
|
|
59
|
+
return instance?.constructor.name === FormData.name;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static #enfoldEntry(name, value, filename) {
|
|
63
|
+
name = toUSVString(name);
|
|
64
|
+
filename &&= toUSVString(filename);
|
|
65
|
+
|
|
66
|
+
if (File.alike(value)) {
|
|
67
|
+
value = new File([value], filename, value);
|
|
68
|
+
} else if (this.#ensureInstance(value)) {
|
|
69
|
+
value.name = filename || value.name;
|
|
70
|
+
} else {
|
|
71
|
+
value = toUSVString(value);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
name,
|
|
76
|
+
value,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static #ensureInstance(value) {
|
|
81
|
+
return File.alike(value) || (value === Object(value) && Reflect.has(value, Symbol.asyncIterator));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
#entries = [];
|
|
85
|
+
|
|
86
|
+
get [Symbol.toStringTag]() {
|
|
87
|
+
return this.constructor.name;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
constructor(input) {
|
|
91
|
+
if (input === Object(input)
|
|
92
|
+
&& (input?.constructor === Object || Reflect.has(input, Symbol.iterator))) {
|
|
93
|
+
|
|
94
|
+
if (input.constructor !== Object) {
|
|
95
|
+
input = Array.from(input);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (Array.isArray(input)) {
|
|
99
|
+
if (!input.every((it) => Array.isArray(it))) {
|
|
100
|
+
throw new TypeError(`Failed to construct '${
|
|
101
|
+
this[Symbol.toStringTag]
|
|
102
|
+
}': The provided value cannot be converted to a sequence.`);
|
|
103
|
+
} else if (!input.every((it) => it.length === 2)) {
|
|
104
|
+
throw new TypeError(`Failed to construct '${
|
|
105
|
+
this[Symbol.toStringTag]
|
|
106
|
+
}': Sequence initializer must only contain pair elements.`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (input.constructor === Object) {
|
|
111
|
+
input = Object.entries(input);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
input.forEach(([key, value]) => this.append(key, value));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
#ensureArgs(args, expected, method) {
|
|
119
|
+
if (args.length < expected) {
|
|
120
|
+
throw new TypeError(`Failed to execute '${ method }' on '${
|
|
121
|
+
this[Symbol.toStringTag]
|
|
122
|
+
}': ${ expected } arguments required, but only ${ args.length } present.`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if ([
|
|
126
|
+
'append',
|
|
127
|
+
'set',
|
|
128
|
+
].includes(method)) {
|
|
129
|
+
if (args.length === 3 && !this.constructor.#ensureInstance(args[1])) {
|
|
130
|
+
throw new TypeError(`Failed to execute '${ method }' on '${
|
|
131
|
+
this[Symbol.toStringTag]
|
|
132
|
+
}': parameter ${ expected } is not of type 'Blob', 'File' or async iterable.`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (method === 'forEach') {
|
|
137
|
+
if (args[0]?.constructor !== Function) {
|
|
138
|
+
throw new TypeError(`Failed to execute '${ method }' on '${
|
|
139
|
+
this[Symbol.toStringTag]
|
|
140
|
+
}': parameter ${ expected } is not of type 'Function'.`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
append(...args) {
|
|
146
|
+
collate(this, FormData);
|
|
147
|
+
this.#ensureArgs(args, 2, 'append');
|
|
148
|
+
this.#entries.push(this.constructor.#enfoldEntry(...args));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
delete(...args) {
|
|
152
|
+
collate(this, FormData);
|
|
153
|
+
this.#ensureArgs(args, 1, 'delete');
|
|
154
|
+
const name = toUSVString(args[0]);
|
|
155
|
+
|
|
156
|
+
this.#entries = this.#entries.filter((it) => it.name !== name);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
forEach(...args) {
|
|
160
|
+
collate(this, FormData);
|
|
161
|
+
this.#ensureArgs(args, 1, 'forEach');
|
|
162
|
+
const [callback, thisArg] = args;
|
|
163
|
+
|
|
164
|
+
for (const entry of this) {
|
|
165
|
+
Reflect.apply(callback, thisArg, [
|
|
166
|
+
...entry.reverse(),
|
|
167
|
+
this,
|
|
168
|
+
]);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
get(...args) {
|
|
173
|
+
collate(this, FormData);
|
|
174
|
+
this.#ensureArgs(args, 1, 'get');
|
|
175
|
+
const name = toUSVString(args[0]);
|
|
176
|
+
|
|
177
|
+
return (this.#entries.find((it) => it.name === name) ?? {}).value ?? null;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
getAll(...args) {
|
|
181
|
+
collate(this, FormData);
|
|
182
|
+
this.#ensureArgs(args, 1, 'getAll');
|
|
183
|
+
const name = toUSVString(args[0]);
|
|
184
|
+
|
|
185
|
+
return this.#entries.filter((it) => it.name === name).map((it) => it.value);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
has(...args) {
|
|
189
|
+
collate(this, FormData);
|
|
190
|
+
this.#ensureArgs(args, 1, 'has');
|
|
191
|
+
const name = toUSVString(args[0]);
|
|
192
|
+
|
|
193
|
+
return !!this.#entries.find((it) => it.name === name);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
set(...args) {
|
|
197
|
+
collate(this, FormData);
|
|
198
|
+
this.#ensureArgs(args, 2, 'set');
|
|
199
|
+
const entry = this.constructor.#enfoldEntry(...args);
|
|
200
|
+
const idx = this.#entries.findIndex((it) => it.name === entry.name);
|
|
201
|
+
|
|
202
|
+
if (idx !== -1) {
|
|
203
|
+
this.#entries.splice(idx, 1, entry);
|
|
204
|
+
} else {
|
|
205
|
+
this.#entries.push(entry);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
* entries() {
|
|
210
|
+
collate(this, FormData);
|
|
211
|
+
for (const { name, value } of this.#entries) {
|
|
212
|
+
yield [
|
|
213
|
+
name,
|
|
214
|
+
value,
|
|
215
|
+
];
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
* keys() {
|
|
220
|
+
collate(this, FormData);
|
|
221
|
+
for (const [name] of this) {
|
|
222
|
+
yield name;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
* values() {
|
|
227
|
+
collate(this, FormData);
|
|
228
|
+
for (const [, value] of this) {
|
|
229
|
+
yield value;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
[Symbol.iterator]() {
|
|
234
|
+
collate(this, FormData);
|
|
235
|
+
|
|
236
|
+
return this.entries();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
}
|
package/src/utils.mjs
CHANGED