Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2023-10-23 18:03:04 +00:00
parent 79817eb679
commit 9c3b394d7f
402 changed files with 12598 additions and 2912 deletions

100
node_modules/nock/lib/common.js generated vendored
View file

@ -1,8 +1,6 @@
'use strict'
const debug = require('debug')('nock.common')
const isPlainObject = require('lodash/isPlainObject')
const set = require('lodash/set')
const timers = require('timers')
const url = require('url')
const util = require('util')
@ -568,17 +566,6 @@ const dataEqual = (expected, actual) => {
return deepEqual(expected, actual)
}
/**
* Converts flat objects whose keys use JSON path notation to nested objects.
*
* The input object is not mutated.
*
* @example
* { 'foo[bar][0]': 'baz' } -> { foo: { bar: [ 'baz' ] } }
*/
const expand = input =>
Object.entries(input).reduce((acc, [k, v]) => set(acc, k, v), {})
/**
* Performs a recursive strict comparison between two values.
*
@ -665,10 +652,97 @@ function isRequestDestroyed(req) {
)
}
/**
* Returns true if the given value is a plain object and not an Array.
* @param {*} value
* @returns {boolean}
*/
function isPlainObject(value) {
if (typeof value !== 'object' || value === null) return false
if (Object.prototype.toString.call(value) !== '[object Object]') return false
const proto = Object.getPrototypeOf(value)
if (proto === null) return true
const Ctor =
Object.prototype.hasOwnProperty.call(proto, 'constructor') &&
proto.constructor
return (
typeof Ctor === 'function' &&
Ctor instanceof Ctor &&
Function.prototype.call(Ctor) === Function.prototype.call(value)
)
}
const prototypePollutionBlockList = ['__proto__', 'prototype', 'constructor']
const blocklistFilter = function (part) {
return prototypePollutionBlockList.indexOf(part) === -1
}
/**
* Converts flat objects whose keys use JSON path notation to nested objects.
*
* The input object is not mutated.
*
* @example
* { 'foo[bar][0]': 'baz' } -> { foo: { bar: [ 'baz' ] } }
*/
const expand = input => {
if (input === undefined || input === null) {
return input
}
const keys = Object.keys(input)
const result = {}
let resultPtr = result
for (let path of keys) {
const originalPath = path
if (path.indexOf('[') >= 0) {
path = path.replace(/\[/g, '.').replace(/]/g, '')
}
const parts = path.split('.')
const check = parts.filter(blocklistFilter)
if (check.length !== parts.length) {
return undefined
}
resultPtr = result
const lastIndex = parts.length - 1
for (let i = 0; i < parts.length; ++i) {
const part = parts[i]
if (i === lastIndex) {
if (Array.isArray(resultPtr)) {
resultPtr[+part] = input[originalPath]
} else {
resultPtr[part] = input[originalPath]
}
} else {
if (resultPtr[part] === undefined || resultPtr[part] === null) {
const nextPart = parts[i + 1]
if (/^\d+$/.test(nextPart)) {
resultPtr[part] = []
} else {
resultPtr[part] = {}
}
}
resultPtr = resultPtr[part]
}
}
}
return result
}
module.exports = {
contentEncoding,
dataEqual,
deleteHeadersField,
expand,
forEachHeader,
formatQueryValue,
headersArrayToObject,