Socket
Socket
Sign inDemoInstall

fetch-mock

Package Overview
Dependencies
Maintainers
3
Versions
226
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-mock - npm Package Compare versions

Comparing version 7.2.8 to 7.3.0

16

es5/lib/generate-matcher.js

@@ -118,4 +118,8 @@ 'use strict';

var getFunctionMatcher = function getFunctionMatcher(_ref8) {
var matcher = _ref8.matcher;
return typeof matcher === 'function' && matcher;
var matcher = _ref8.matcher,
_ref8$functionMatcher = _ref8.functionMatcher,
functionMatcher = _ref8$functionMatcher === undefined ? function () {
return true;
} : _ref8$functionMatcher;
return typeof matcher === 'function' ? matcher : functionMatcher;
};

@@ -128,2 +132,8 @@

if (typeof matcher === 'function') {
return function () {
return true;
};
}
if (matcher instanceof RegExp) {

@@ -166,3 +176,3 @@ return function (url) {

module.exports = function (route) {
var matchers = [route.query && getQueryStringMatcher(route), route.method && getMethodMatcher(route), route.headers && getHeaderMatcher(route), route.params && getParamsMatcher(route), getFunctionMatcher(route) || getUrlMatcher(route)].filter(function (matcher) {
var matchers = [route.query && getQueryStringMatcher(route), route.method && getMethodMatcher(route), route.headers && getHeaderMatcher(route), route.params && getParamsMatcher(route), getFunctionMatcher(route), getUrlMatcher(route)].filter(function (matcher) {
return !!matcher;

@@ -169,0 +179,0 @@ });

2

package.json
{
"name": "fetch-mock",
"version": "7.2.8",
"version": "7.3.0",
"description": "Mock http requests made using fetch (or isomorphic-fetch)",

@@ -5,0 +5,0 @@ "main": "src/server.js",

@@ -72,4 +72,4 @@ const glob = require('glob-to-regexp');

const getFunctionMatcher = ({ matcher }) =>
typeof matcher === 'function' && matcher;
const getFunctionMatcher = ({ matcher, functionMatcher = () => true }) =>
typeof matcher === 'function' ? matcher : functionMatcher;

@@ -79,2 +79,6 @@ const getUrlMatcher = route => {

if (typeof matcher === 'function') {
return () => true;
}
if (matcher instanceof RegExp) {

@@ -118,3 +122,4 @@ return url => matcher.test(url);

route.params && getParamsMatcher(route),
getFunctionMatcher(route) || getUrlMatcher(route)
getFunctionMatcher(route),
getUrlMatcher(route)
].filter(matcher => !!matcher);

@@ -121,0 +126,0 @@

Sorry, the diff of this file is too big to display

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