extra-request 3.0.3 → 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.
@@ -257,19 +257,167 @@ var jsonRpc = {};
257
257
 
258
258
  var object = {};
259
259
 
260
- object.isntEmptyObject = object.isEmptyObject = object.isRecord = object.isntObject = object.isObject = void 0;
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);
261
404
  function isObject(val) {
262
- return val !== null && typeof val === 'object';
405
+ return val !== null
406
+ && typeof val === 'object';
263
407
  }
264
408
  object.isObject = isObject;
265
409
  function isntObject(val) {
266
410
  return !isObject(val);
267
411
  }
268
412
  object.isntObject = isntObject;
269
- function isRecord(val) {
270
- return isObject(val);
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);
271
419
  }
272
- object.isRecord = isRecord;
420
+ object.isntPlainObject = isntPlainObject;
273
421
  function isEmptyObject(val) {
274
422
  return Object.keys(val).length === 0;
275
423
  }
@@ -304,7 +452,7 @@ function isJsonRpcParams(val) {
304
452
  return (0, array_1.isArray)(val) || (0, object_1.isObject)(val);
305
453
  }
306
454
  function isJsonRpcNotification(val) {
307
- return (0, object_1.isRecord)(val)
455
+ return (0, object_1.isPlainObject)(val)
308
456
  && (0, string_1.isString)(val.jsonrpc)
309
457
  && (0, string_1.isString)(val.method)
310
458
  && (0, undefined_1.isUndefined)(val.id)
@@ -316,7 +464,7 @@ function isntJsonRpcNotification(val) {
316
464
  }
317
465
  jsonRpc.isntJsonRpcNotification = isntJsonRpcNotification;
318
466
  function isJsonRpcRequest(val) {
319
- return (0, object_1.isRecord)(val)
467
+ return (0, object_1.isPlainObject)(val)
320
468
  && (0, string_1.isString)(val.jsonrpc)
321
469
  && (0, string_1.isString)(val.method)
322
470
  && isJsonRpcId(val.id)
@@ -328,7 +476,7 @@ function isntJsonRpcRequest(val) {
328
476
  }
329
477
  jsonRpc.isntJsonRpcRequest = isntJsonRpcRequest;
330
478
  function isJsonRpcSuccess(val) {
331
- return (0, object_1.isRecord)(val)
479
+ return (0, object_1.isPlainObject)(val)
332
480
  && (0, string_1.isString)(val.jsonrpc)
333
481
  && (0, string_1.isString)(val.id)
334
482
  && 'result' in val;
@@ -339,7 +487,7 @@ function isntJsonRpcSuccess(val) {
339
487
  }
340
488
  jsonRpc.isntJsonRpcSuccess = isntJsonRpcSuccess;
341
489
  function isJsonRpcError(val) {
342
- return (0, object_1.isRecord)(val)
490
+ return (0, object_1.isPlainObject)(val)
343
491
  && (0, string_1.isString)(val.jsonrpc)
344
492
  && isJsonRpcId(val.id)
345
493
  && isJsonRpcErrorObject(val.error);
@@ -350,7 +498,7 @@ function isntJsonRpcError(val) {
350
498
  }
351
499
  jsonRpc.isntJsonRpcError = isntJsonRpcError;
352
500
  function isJsonRpcErrorObject(val) {
353
- return (0, object_1.isRecord)(val)
501
+ return (0, object_1.isPlainObject)(val)
354
502
  && (0, number_1.isNumber)(val.code)
355
503
  && (0, string_1.isString)(val.message)
356
504
  && ((0, undefined_1.isUndefined)(val.data) || (0, object_1.isObject)(val.data));