extra-request 3.0.0 → 4.0.0
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/LICENSE +1 -1
- package/dist/es2015/index.min.mjs +2 -2
- package/dist/es2015/index.min.mjs.map +1 -1
- package/dist/es2015/index.mjs +201 -68
- package/dist/es2015/index.mjs.map +1 -1
- package/dist/es2015/index.umd.js +203 -70
- package/dist/es2015/index.umd.js.map +1 -1
- package/dist/es2015/index.umd.min.js +2 -2
- package/dist/es2015/index.umd.min.js.map +1 -1
- package/dist/es2018/index.min.mjs +2 -2
- package/dist/es2018/index.min.mjs.map +1 -1
- package/dist/es2018/index.mjs +201 -68
- package/dist/es2018/index.mjs.map +1 -1
- package/dist/es2018/index.umd.js +203 -70
- package/dist/es2018/index.umd.js.map +1 -1
- package/dist/es2018/index.umd.min.js +2 -2
- package/dist/es2018/index.umd.min.js.map +1 -1
- package/lib/es2015/request.js +1 -1
- package/lib/es2015/request.js.map +1 -1
- package/lib/es2015/transformers/accept.js +1 -1
- package/lib/es2015/transformers/accept.js.map +1 -1
- package/lib/es2015/transformers/basic-auth.js +1 -1
- package/lib/es2015/transformers/basic-auth.js.map +1 -1
- package/lib/es2015/transformers/bearer-auth.js +1 -1
- package/lib/es2015/transformers/bearer-auth.js.map +1 -1
- package/lib/es2015/transformers/csv.js +2 -2
- package/lib/es2015/transformers/csv.js.map +1 -1
- package/lib/es2015/transformers/form-data-field.js +2 -1
- package/lib/es2015/transformers/form-data-field.js.map +1 -1
- package/lib/es2018/request.js +1 -1
- package/lib/es2018/request.js.map +1 -1
- package/lib/es2018/transformers/accept.js +1 -1
- package/lib/es2018/transformers/accept.js.map +1 -1
- package/lib/es2018/transformers/basic-auth.js +1 -1
- package/lib/es2018/transformers/basic-auth.js.map +1 -1
- package/lib/es2018/transformers/bearer-auth.js +1 -1
- package/lib/es2018/transformers/bearer-auth.js.map +1 -1
- package/lib/es2018/transformers/csv.js +2 -2
- package/lib/es2018/transformers/csv.js.map +1 -1
- package/lib/es2018/transformers/form-data-field.js +2 -1
- package/lib/es2018/transformers/form-data-field.js.map +1 -1
- package/package.json +27 -25
package/dist/es2015/index.mjs
CHANGED
|
@@ -32,6 +32,11 @@ var abortController_browser = {};
|
|
|
32
32
|
abortController_browser.AbortController = void 0;
|
|
33
33
|
abortController_browser.AbortController = globalThis.AbortController;
|
|
34
34
|
|
|
35
|
+
var abortError_browser = {};
|
|
36
|
+
|
|
37
|
+
abortError_browser.AbortError = void 0;
|
|
38
|
+
abortError_browser.AbortError = globalThis.DOMException;
|
|
39
|
+
|
|
35
40
|
var blob_browser = {};
|
|
36
41
|
|
|
37
42
|
blob_browser.Blob = void 0;
|
|
@@ -58,6 +63,7 @@ __exportStar(request_browser, exports);
|
|
|
58
63
|
__exportStar(response_browser, exports);
|
|
59
64
|
__exportStar(formData_browser, exports);
|
|
60
65
|
__exportStar(abortController_browser, exports);
|
|
66
|
+
__exportStar(abortError_browser, exports);
|
|
61
67
|
__exportStar(blob_browser, exports);
|
|
62
68
|
__exportStar(eventSource_browser, exports);
|
|
63
69
|
|
|
@@ -115,8 +121,8 @@ asyncIterable.isntAsyncIterable = asyncIterable.isAsyncIterable = void 0;
|
|
|
115
121
|
const null_1$1 = _null;
|
|
116
122
|
const undefined_1$2 = _undefined;
|
|
117
123
|
function isAsyncIterable(val) {
|
|
118
|
-
return null_1$1.isntNull(val)
|
|
119
|
-
&& undefined_1$2.isntUndefined(val)
|
|
124
|
+
return (0, null_1$1.isntNull)(val)
|
|
125
|
+
&& (0, undefined_1$2.isntUndefined)(val)
|
|
120
126
|
&& typeof val[Symbol.asyncIterator] === 'function';
|
|
121
127
|
}
|
|
122
128
|
asyncIterable.isAsyncIterable = isAsyncIterable;
|
|
@@ -153,36 +159,20 @@ var char = {};
|
|
|
153
159
|
|
|
154
160
|
var string = {};
|
|
155
161
|
|
|
156
|
-
string.
|
|
162
|
+
string.isntString = string.isString = void 0;
|
|
157
163
|
function isString(val) {
|
|
158
|
-
return
|
|
164
|
+
return typeof val === 'string';
|
|
159
165
|
}
|
|
160
166
|
string.isString = isString;
|
|
161
167
|
function isntString(val) {
|
|
162
168
|
return !isString(val);
|
|
163
169
|
}
|
|
164
170
|
string.isntString = isntString;
|
|
165
|
-
function isStringPrimitive(val) {
|
|
166
|
-
return typeof val === 'string';
|
|
167
|
-
}
|
|
168
|
-
string.isStringPrimitive = isStringPrimitive;
|
|
169
|
-
function isntStringPrimitive(val) {
|
|
170
|
-
return !isStringPrimitive(val);
|
|
171
|
-
}
|
|
172
|
-
string.isntStringPrimitive = isntStringPrimitive;
|
|
173
|
-
function isStringObject(val) {
|
|
174
|
-
return typeof val === 'object' && val instanceof String;
|
|
175
|
-
}
|
|
176
|
-
string.isStringObject = isStringObject;
|
|
177
|
-
function isntStringObject(val) {
|
|
178
|
-
return !isStringObject(val);
|
|
179
|
-
}
|
|
180
|
-
string.isntStringObject = isntStringObject;
|
|
181
171
|
|
|
182
|
-
char.
|
|
172
|
+
char.isntChar = char.isChar = void 0;
|
|
183
173
|
const string_1$1 = string;
|
|
184
174
|
function isChar(val) {
|
|
185
|
-
return (string_1$1.isString
|
|
175
|
+
return (0, string_1$1.isString)(val)
|
|
186
176
|
&& val.length === 1;
|
|
187
177
|
}
|
|
188
178
|
char.isChar = isChar;
|
|
@@ -190,24 +180,6 @@ function isntChar(val) {
|
|
|
190
180
|
return !isChar(val);
|
|
191
181
|
}
|
|
192
182
|
char.isntChar = isntChar;
|
|
193
|
-
function isCharPrimitive(val) {
|
|
194
|
-
return string_1$1.isString(val)
|
|
195
|
-
&& val.length === 1;
|
|
196
|
-
}
|
|
197
|
-
char.isCharPrimitive = isCharPrimitive;
|
|
198
|
-
function isntCharPrimitive(val) {
|
|
199
|
-
return !isCharPrimitive(val);
|
|
200
|
-
}
|
|
201
|
-
char.isntCharPrimitive = isntCharPrimitive;
|
|
202
|
-
function isCharObject(val) {
|
|
203
|
-
return string_1$1.isStringObject(val)
|
|
204
|
-
&& val.length === 1;
|
|
205
|
-
}
|
|
206
|
-
char.isCharObject = isCharObject;
|
|
207
|
-
function isntCharObject(val) {
|
|
208
|
-
return !isCharObject(val);
|
|
209
|
-
}
|
|
210
|
-
char.isntCharObject = isntCharObject;
|
|
211
183
|
|
|
212
184
|
var date = {};
|
|
213
185
|
|
|
@@ -229,6 +201,18 @@ function inEnum(val, _enum) {
|
|
|
229
201
|
}
|
|
230
202
|
_enum.inEnum = inEnum;
|
|
231
203
|
|
|
204
|
+
var error = {};
|
|
205
|
+
|
|
206
|
+
error.isntError = error.isError = void 0;
|
|
207
|
+
function isError(val) {
|
|
208
|
+
return val instanceof Error;
|
|
209
|
+
}
|
|
210
|
+
error.isError = isError;
|
|
211
|
+
function isntError(val) {
|
|
212
|
+
return !isError(val);
|
|
213
|
+
}
|
|
214
|
+
error.isntError = isntError;
|
|
215
|
+
|
|
232
216
|
var falsy = {};
|
|
233
217
|
|
|
234
218
|
falsy.isntFalsy = falsy.isFalsy = void 0;
|
|
@@ -259,8 +243,8 @@ iterable.isntIterable = iterable.isIterable = void 0;
|
|
|
259
243
|
const null_1 = _null;
|
|
260
244
|
const undefined_1$1 = _undefined;
|
|
261
245
|
function isIterable(val) {
|
|
262
|
-
return null_1.isntNull(val)
|
|
263
|
-
&& undefined_1$1.isntUndefined(val)
|
|
246
|
+
return (0, null_1.isntNull)(val)
|
|
247
|
+
&& (0, undefined_1$1.isntUndefined)(val)
|
|
264
248
|
&& typeof val[Symbol.iterator] === 'function';
|
|
265
249
|
}
|
|
266
250
|
iterable.isIterable = isIterable;
|
|
@@ -273,19 +257,167 @@ var jsonRpc = {};
|
|
|
273
257
|
|
|
274
258
|
var object = {};
|
|
275
259
|
|
|
276
|
-
|
|
260
|
+
/**
|
|
261
|
+
* lodash (Custom Build) <https://lodash.com/>
|
|
262
|
+
* Build: `lodash modularize exports="npm" -o ./`
|
|
263
|
+
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
264
|
+
* Released under MIT license <https://lodash.com/license>
|
|
265
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
266
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
267
|
+
*/
|
|
268
|
+
|
|
269
|
+
/** `Object#toString` result references. */
|
|
270
|
+
var objectTag = '[object Object]';
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Checks if `value` is a host object in IE < 9.
|
|
274
|
+
*
|
|
275
|
+
* @private
|
|
276
|
+
* @param {*} value The value to check.
|
|
277
|
+
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
|
|
278
|
+
*/
|
|
279
|
+
function isHostObject(value) {
|
|
280
|
+
// Many host objects are `Object` objects that can coerce to strings
|
|
281
|
+
// despite having improperly defined `toString` methods.
|
|
282
|
+
var result = false;
|
|
283
|
+
if (value != null && typeof value.toString != 'function') {
|
|
284
|
+
try {
|
|
285
|
+
result = !!(value + '');
|
|
286
|
+
} catch (e) {}
|
|
287
|
+
}
|
|
288
|
+
return result;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Creates a unary function that invokes `func` with its argument transformed.
|
|
293
|
+
*
|
|
294
|
+
* @private
|
|
295
|
+
* @param {Function} func The function to wrap.
|
|
296
|
+
* @param {Function} transform The argument transform.
|
|
297
|
+
* @returns {Function} Returns the new function.
|
|
298
|
+
*/
|
|
299
|
+
function overArg(func, transform) {
|
|
300
|
+
return function(arg) {
|
|
301
|
+
return func(transform(arg));
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** Used for built-in method references. */
|
|
306
|
+
var funcProto = Function.prototype,
|
|
307
|
+
objectProto = Object.prototype;
|
|
308
|
+
|
|
309
|
+
/** Used to resolve the decompiled source of functions. */
|
|
310
|
+
var funcToString = funcProto.toString;
|
|
311
|
+
|
|
312
|
+
/** Used to check objects for own properties. */
|
|
313
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
314
|
+
|
|
315
|
+
/** Used to infer the `Object` constructor. */
|
|
316
|
+
var objectCtorString = funcToString.call(Object);
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Used to resolve the
|
|
320
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
321
|
+
* of values.
|
|
322
|
+
*/
|
|
323
|
+
var objectToString = objectProto.toString;
|
|
324
|
+
|
|
325
|
+
/** Built-in value references. */
|
|
326
|
+
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
330
|
+
* and has a `typeof` result of "object".
|
|
331
|
+
*
|
|
332
|
+
* @static
|
|
333
|
+
* @memberOf _
|
|
334
|
+
* @since 4.0.0
|
|
335
|
+
* @category Lang
|
|
336
|
+
* @param {*} value The value to check.
|
|
337
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
338
|
+
* @example
|
|
339
|
+
*
|
|
340
|
+
* _.isObjectLike({});
|
|
341
|
+
* // => true
|
|
342
|
+
*
|
|
343
|
+
* _.isObjectLike([1, 2, 3]);
|
|
344
|
+
* // => true
|
|
345
|
+
*
|
|
346
|
+
* _.isObjectLike(_.noop);
|
|
347
|
+
* // => false
|
|
348
|
+
*
|
|
349
|
+
* _.isObjectLike(null);
|
|
350
|
+
* // => false
|
|
351
|
+
*/
|
|
352
|
+
function isObjectLike(value) {
|
|
353
|
+
return !!value && typeof value == 'object';
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
358
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
359
|
+
*
|
|
360
|
+
* @static
|
|
361
|
+
* @memberOf _
|
|
362
|
+
* @since 0.8.0
|
|
363
|
+
* @category Lang
|
|
364
|
+
* @param {*} value The value to check.
|
|
365
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
366
|
+
* @example
|
|
367
|
+
*
|
|
368
|
+
* function Foo() {
|
|
369
|
+
* this.a = 1;
|
|
370
|
+
* }
|
|
371
|
+
*
|
|
372
|
+
* _.isPlainObject(new Foo);
|
|
373
|
+
* // => false
|
|
374
|
+
*
|
|
375
|
+
* _.isPlainObject([1, 2, 3]);
|
|
376
|
+
* // => false
|
|
377
|
+
*
|
|
378
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
379
|
+
* // => true
|
|
380
|
+
*
|
|
381
|
+
* _.isPlainObject(Object.create(null));
|
|
382
|
+
* // => true
|
|
383
|
+
*/
|
|
384
|
+
function isPlainObject$1(value) {
|
|
385
|
+
if (!isObjectLike(value) ||
|
|
386
|
+
objectToString.call(value) != objectTag || isHostObject(value)) {
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
var proto = getPrototype(value);
|
|
390
|
+
if (proto === null) {
|
|
391
|
+
return true;
|
|
392
|
+
}
|
|
393
|
+
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
394
|
+
return (typeof Ctor == 'function' &&
|
|
395
|
+
Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
var lodash_isplainobject = isPlainObject$1;
|
|
399
|
+
|
|
400
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
401
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
402
|
+
};object.isntEmptyObject = object.isEmptyObject = object.isntPlainObject = object.isPlainObject = object.isntObject = object.isObject = void 0;
|
|
403
|
+
const lodash_isplainobject_1 = __importDefault(lodash_isplainobject);
|
|
277
404
|
function isObject(val) {
|
|
278
|
-
return val !== null
|
|
405
|
+
return val !== null
|
|
406
|
+
&& typeof val === 'object';
|
|
279
407
|
}
|
|
280
408
|
object.isObject = isObject;
|
|
281
409
|
function isntObject(val) {
|
|
282
410
|
return !isObject(val);
|
|
283
411
|
}
|
|
284
412
|
object.isntObject = isntObject;
|
|
285
|
-
function
|
|
286
|
-
return
|
|
413
|
+
function isPlainObject(val) {
|
|
414
|
+
return (0, lodash_isplainobject_1.default)(val);
|
|
415
|
+
}
|
|
416
|
+
object.isPlainObject = isPlainObject;
|
|
417
|
+
function isntPlainObject(val) {
|
|
418
|
+
return !isPlainObject(val);
|
|
287
419
|
}
|
|
288
|
-
object.
|
|
420
|
+
object.isntPlainObject = isntPlainObject;
|
|
289
421
|
function isEmptyObject(val) {
|
|
290
422
|
return Object.keys(val).length === 0;
|
|
291
423
|
}
|
|
@@ -314,16 +446,16 @@ const string_1 = string;
|
|
|
314
446
|
const number_1 = number;
|
|
315
447
|
const undefined_1 = _undefined;
|
|
316
448
|
function isJsonRpcId(val) {
|
|
317
|
-
return string_1.isString(val) || number_1.isNumber(val);
|
|
449
|
+
return (0, string_1.isString)(val) || (0, number_1.isNumber)(val);
|
|
318
450
|
}
|
|
319
451
|
function isJsonRpcParams(val) {
|
|
320
|
-
return array_1.isArray(val) || object_1.isObject(val);
|
|
452
|
+
return (0, array_1.isArray)(val) || (0, object_1.isObject)(val);
|
|
321
453
|
}
|
|
322
454
|
function isJsonRpcNotification(val) {
|
|
323
|
-
return object_1.
|
|
324
|
-
&& string_1.isString(val.jsonrpc)
|
|
325
|
-
&& string_1.isString(val.method)
|
|
326
|
-
&& undefined_1.isUndefined(val.id)
|
|
455
|
+
return (0, object_1.isPlainObject)(val)
|
|
456
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
457
|
+
&& (0, string_1.isString)(val.method)
|
|
458
|
+
&& (0, undefined_1.isUndefined)(val.id)
|
|
327
459
|
&& isJsonRpcParams(val.params);
|
|
328
460
|
}
|
|
329
461
|
jsonRpc.isJsonRpcNotification = isJsonRpcNotification;
|
|
@@ -332,9 +464,9 @@ function isntJsonRpcNotification(val) {
|
|
|
332
464
|
}
|
|
333
465
|
jsonRpc.isntJsonRpcNotification = isntJsonRpcNotification;
|
|
334
466
|
function isJsonRpcRequest(val) {
|
|
335
|
-
return object_1.
|
|
336
|
-
&& string_1.isString(val.jsonrpc)
|
|
337
|
-
&& string_1.isString(val.method)
|
|
467
|
+
return (0, object_1.isPlainObject)(val)
|
|
468
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
469
|
+
&& (0, string_1.isString)(val.method)
|
|
338
470
|
&& isJsonRpcId(val.id)
|
|
339
471
|
&& isJsonRpcParams(val.params);
|
|
340
472
|
}
|
|
@@ -344,10 +476,10 @@ function isntJsonRpcRequest(val) {
|
|
|
344
476
|
}
|
|
345
477
|
jsonRpc.isntJsonRpcRequest = isntJsonRpcRequest;
|
|
346
478
|
function isJsonRpcSuccess(val) {
|
|
347
|
-
return object_1.
|
|
348
|
-
&& string_1.isString(val.jsonrpc)
|
|
349
|
-
&& string_1.isString(val.id)
|
|
350
|
-
&&
|
|
479
|
+
return (0, object_1.isPlainObject)(val)
|
|
480
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
481
|
+
&& (0, string_1.isString)(val.id)
|
|
482
|
+
&& 'result' in val;
|
|
351
483
|
}
|
|
352
484
|
jsonRpc.isJsonRpcSuccess = isJsonRpcSuccess;
|
|
353
485
|
function isntJsonRpcSuccess(val) {
|
|
@@ -355,8 +487,8 @@ function isntJsonRpcSuccess(val) {
|
|
|
355
487
|
}
|
|
356
488
|
jsonRpc.isntJsonRpcSuccess = isntJsonRpcSuccess;
|
|
357
489
|
function isJsonRpcError(val) {
|
|
358
|
-
return object_1.
|
|
359
|
-
&& string_1.isString(val.jsonrpc)
|
|
490
|
+
return (0, object_1.isPlainObject)(val)
|
|
491
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
360
492
|
&& isJsonRpcId(val.id)
|
|
361
493
|
&& isJsonRpcErrorObject(val.error);
|
|
362
494
|
}
|
|
@@ -366,10 +498,10 @@ function isntJsonRpcError(val) {
|
|
|
366
498
|
}
|
|
367
499
|
jsonRpc.isntJsonRpcError = isntJsonRpcError;
|
|
368
500
|
function isJsonRpcErrorObject(val) {
|
|
369
|
-
return object_1.
|
|
370
|
-
&& number_1.isNumber(val.code)
|
|
371
|
-
&& string_1.isString(val.message)
|
|
372
|
-
&& (undefined_1.isUndefined(val.data) || object_1.isObject(val.data));
|
|
501
|
+
return (0, object_1.isPlainObject)(val)
|
|
502
|
+
&& (0, number_1.isNumber)(val.code)
|
|
503
|
+
&& (0, string_1.isString)(val.message)
|
|
504
|
+
&& ((0, undefined_1.isUndefined)(val.data) || (0, object_1.isObject)(val.data));
|
|
373
505
|
}
|
|
374
506
|
|
|
375
507
|
var json$1 = {};
|
|
@@ -421,6 +553,7 @@ __exportStar(boolean, exports);
|
|
|
421
553
|
__exportStar(char, exports);
|
|
422
554
|
__exportStar(date, exports);
|
|
423
555
|
__exportStar(_enum, exports);
|
|
556
|
+
__exportStar(error, exports);
|
|
424
557
|
__exportStar(falsy, exports);
|
|
425
558
|
__exportStar(_function, exports);
|
|
426
559
|
__exportStar(iterable, exports);
|
|
@@ -703,7 +836,7 @@ function formDataField(name, value) {
|
|
|
703
836
|
const formData = options.payload instanceof es2018$2.FormData
|
|
704
837
|
? cloneFormData(options.payload)
|
|
705
838
|
: new es2018$2.FormData();
|
|
706
|
-
if (
|
|
839
|
+
if (es2018$1.isArray(value)) {
|
|
707
840
|
value.forEach(x => formData.append(name, x));
|
|
708
841
|
}
|
|
709
842
|
else {
|
|
@@ -736,7 +869,7 @@ const _hasBuffer = typeof Buffer === 'function';
|
|
|
736
869
|
typeof TextDecoder === 'function' ? new TextDecoder() : undefined;
|
|
737
870
|
typeof TextEncoder === 'function' ? new TextEncoder() : undefined;
|
|
738
871
|
const b64ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
739
|
-
const b64chs =
|
|
872
|
+
const b64chs = Array.prototype.slice.call(b64ch);
|
|
740
873
|
((a) => {
|
|
741
874
|
let tab = {};
|
|
742
875
|
a.forEach((c, i) => tab[c] = i);
|