Update checked-in dependencies
This commit is contained in:
parent
4fad06f438
commit
40a500c743
4168 changed files with 298222 additions and 374905 deletions
77
node_modules/nock/lib/common.js
generated
vendored
77
node_modules/nock/lib/common.js
generated
vendored
|
|
@ -1,7 +1,8 @@
|
|||
'use strict'
|
||||
|
||||
const debug = require('debug')('nock.common')
|
||||
const set = require('lodash.set')
|
||||
const isPlainObject = require('lodash/isPlainObject')
|
||||
const set = require('lodash/set')
|
||||
const timers = require('timers')
|
||||
const url = require('url')
|
||||
const util = require('util')
|
||||
|
|
@ -194,7 +195,7 @@ function isJSONContent(headers) {
|
|||
*
|
||||
* Duplicates throw an error.
|
||||
*/
|
||||
function headersFieldNamesToLowerCase(headers) {
|
||||
function headersFieldNamesToLowerCase(headers, throwOnDuplicate) {
|
||||
if (!isPlainObject(headers)) {
|
||||
throw Error('Headers must be provided as an object')
|
||||
}
|
||||
|
|
@ -203,9 +204,15 @@ function headersFieldNamesToLowerCase(headers) {
|
|||
Object.entries(headers).forEach(([fieldName, fieldValue]) => {
|
||||
const key = fieldName.toLowerCase()
|
||||
if (lowerCaseHeaders[key] !== undefined) {
|
||||
throw Error(
|
||||
`Failed to convert header keys to lower case due to field name conflict: ${key}`
|
||||
)
|
||||
if (throwOnDuplicate) {
|
||||
throw Error(
|
||||
`Failed to convert header keys to lower case due to field name conflict: ${key}`
|
||||
)
|
||||
} else {
|
||||
debug(
|
||||
`Duplicate header provided in request: ${key}. Only the last value can be matched.`
|
||||
)
|
||||
}
|
||||
}
|
||||
lowerCaseHeaders[key] = fieldValue
|
||||
})
|
||||
|
|
@ -547,7 +554,7 @@ function urlToOptions(url) {
|
|||
* Used for comparing decoded search parameters, request body JSON objects,
|
||||
* and URL decoded request form bodies.
|
||||
*
|
||||
* Performs a general recursive strict comparision with two caveats:
|
||||
* Performs a general recursive strict comparison with two caveats:
|
||||
* - The expected data can use regexp to compare values
|
||||
* - JSON path notation and nested objects are considered equal
|
||||
*/
|
||||
|
|
@ -602,60 +609,17 @@ function deepEqual(expected, actual) {
|
|||
return expected === actual
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is a plain object, that is, an object created by the
|
||||
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
||||
* https://github.com/lodash/lodash/blob/588bf3e20db0ae039a822a14a8fa238c5b298e65/isPlainObject.js
|
||||
*
|
||||
* @param {*} value The value to check.
|
||||
* @return {boolean}
|
||||
*/
|
||||
function isPlainObject(value) {
|
||||
const isObjectLike = typeof value === 'object' && value !== null
|
||||
const tag = Object.prototype.toString.call(value)
|
||||
if (!isObjectLike || tag !== '[object Object]') {
|
||||
return false
|
||||
}
|
||||
if (Object.getPrototypeOf(value) === null) {
|
||||
return true
|
||||
}
|
||||
let proto = value
|
||||
while (Object.getPrototypeOf(proto) !== null) {
|
||||
proto = Object.getPrototypeOf(proto)
|
||||
}
|
||||
return Object.getPrototypeOf(value) === proto
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an object with the same keys as `object` and values generated
|
||||
* by running each own enumerable string keyed property of `object` thru
|
||||
* `iteratee`. (iteration order is not guaranteed)
|
||||
* The iteratee is invoked with three arguments: (value, key, object).
|
||||
* https://github.com/lodash/lodash/blob/588bf3e20db0ae039a822a14a8fa238c5b298e65/mapValue.js
|
||||
*
|
||||
* @param {Object} object The object to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {Object} Returns the new mapped object.
|
||||
*/
|
||||
function mapValue(object, iteratee) {
|
||||
object = Object(object)
|
||||
const result = {}
|
||||
|
||||
Object.keys(object).forEach(key => {
|
||||
result[key] = iteratee(object[key], key, object)
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
const timeouts = []
|
||||
const intervals = []
|
||||
const immediates = []
|
||||
|
||||
const wrapTimer = (timer, ids) => (...args) => {
|
||||
const id = timer(...args)
|
||||
ids.push(id)
|
||||
return id
|
||||
}
|
||||
const wrapTimer =
|
||||
(timer, ids) =>
|
||||
(...args) => {
|
||||
const id = timer(...args)
|
||||
ids.push(id)
|
||||
return id
|
||||
}
|
||||
|
||||
const setTimeout = wrapTimer(timers.setTimeout, timeouts)
|
||||
const setInterval = wrapTimer(timers.setInterval, intervals)
|
||||
|
|
@ -717,7 +681,6 @@ module.exports = {
|
|||
isRequestDestroyed,
|
||||
isStream,
|
||||
isUtf8Representable,
|
||||
mapValue,
|
||||
matchStringOrRegexp,
|
||||
normalizeClientRequestArgs,
|
||||
normalizeOrigin,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue