Socket
Socket
Sign inDemoInstall

nock

Package Overview
Dependencies
Maintainers
4
Versions
430
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nock - npm Package Compare versions

Comparing version 13.2.4 to 13.2.5

49

lib/common.js
'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')

@@ -611,47 +612,2 @@ const url = require('url')

/**
* 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 = []

@@ -729,3 +685,2 @@ const intervals = []

isUtf8Representable,
mapValue,
matchStringOrRegexp,

@@ -732,0 +687,0 @@ normalizeClientRequestArgs,

9

lib/match_body.js
'use strict'
const mapValues = require('lodash/mapValues')
const querystring = require('querystring')

@@ -46,3 +47,3 @@

// strip line endings from both so that we get a match no matter what OS we are running on
// if Content-Type does not contains 'multipart'
// if Content-Type does not contain 'multipart'
if (!isMultipart && typeof body === 'string') {

@@ -56,4 +57,4 @@ body = body.replace(/\r?\n|\r/g, '')

// Because the nature of URL encoding, all the values in the body have been cast to strings.
// dataEqual does strict checking so we we have to cast the non-regexp values in the spec too.
// Because the nature of URL encoding, all the values in the body must be cast to strings.
// dataEqual does strict checking, so we have to cast the non-regexp values in the spec too.
if (isUrlencoded) {

@@ -75,5 +76,5 @@ spec = mapValuesDeep(spec, val => (val instanceof RegExp ? val : `${val}`))

if (common.isPlainObject(obj)) {
return common.mapValue(obj, v => mapValuesDeep(v, cb))
return mapValues(obj, v => mapValuesDeep(v, cb))
}
return cb(obj)
}

@@ -10,3 +10,3 @@ {

],
"version": "13.2.4",
"version": "13.2.5",
"author": "Pedro Teixeira <pedro.teixeira@gmail.com>",

@@ -28,7 +28,7 @@ "repository": {

"json-stringify-safe": "^5.0.1",
"lodash.set": "^4.3.2",
"lodash": "^4.17.21",
"propagate": "^2.0.0"
},
"devDependencies": {
"@definitelytyped/dtslint": "^0.0.103",
"@definitelytyped/dtslint": "^0.0.112",
"@sinonjs/fake-timers": "^9.0.0",

@@ -46,10 +46,10 @@ "assert-rejects": "^1.0.0",

"form-data": "^4.0.0",
"got": "^11.3.0",
"got": "^12.1.0",
"mocha": "^9.1.3",
"npm-run-all": "^4.1.5",
"nyc": "^15.0.0",
"prettier": "2.5.1",
"prettier": "2.6.2",
"proxyquire": "^2.1.0",
"rimraf": "^3.0.0",
"semantic-release": "^18.0.1",
"semantic-release": "^19.0.2",
"sinon": "^13.0.1",

@@ -56,0 +56,0 @@ "sinon-chai": "^3.7.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc