Socket
Socket
Sign inDemoInstall

fetch-mock

Package Overview
Dependencies
Maintainers
1
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 10.0.8 to 10.1.0

14

CHANGELOG.md
# Changelog
## [10.1.0](https://github.com/wheresrhys/fetch-mock/compare/fetch-mock-v10.0.8...fetch-mock-v10.1.0) (2024-07-18)
### Features
* **wip:** replace dequal, glob-to-regexp and bump path-to-regexp ([d8d8b25](https://github.com/wheresrhys/fetch-mock/commit/d8d8b259fffbd01a03d5c5bf2768ee48797b68bb))
### Bug Fixes
* failing tests ([65ef567](https://github.com/wheresrhys/fetch-mock/commit/65ef5678ba23c53d27f3b165fe25020d96c498db))
* replace path-to-regexp with regexparam ([4bf3e32](https://github.com/wheresrhys/fetch-mock/commit/4bf3e32f852ffc169ca354288eff86737e131480))
* wildcard import ([ff9fee6](https://github.com/wheresrhys/fetch-mock/commit/ff9fee634db8b019f1384e44d13b4121bc2d62bb))
## [10.0.8](https://github.com/wheresrhys/fetch-mock/compare/fetch-mock-v10.0.8-alpha.1...fetch-mock-v10.0.8) (2024-07-15)

@@ -4,0 +18,0 @@

10

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

@@ -36,6 +36,6 @@ "main": "./dist/commonjs.js",

"debug": "^4.1.1",
"glob-to-regexp": "^0.4.0",
"dequal": "^2.0.3",
"globrex": "^0.1.2",
"is-subset": "^0.1.1",
"lodash.isequal": "^4.5.0",
"path-to-regexp": "^2.2.1"
"regexparam": "^3.0.0"
},

@@ -48,4 +48,4 @@ "peerDependenciesMeta": {

"engines": {
"node": ">=4.0.0"
"node": ">=8.0.0"
}
}

@@ -1,5 +0,5 @@

import glob from 'glob-to-regexp';
import pathToRegexp from 'path-to-regexp';
import glob from 'globrex';
import * as regexparam from 'regexparam';
import isSubset from 'is-subset';
import isEqual from 'lodash.isequal';
import { dequal as isEqual } from 'dequal';
import {

@@ -27,7 +27,7 @@ headers as headerUtils,

const urlRX = glob(targetString);
return debuggableUrlFunc((url) => urlRX.test(url));
return debuggableUrlFunc((url) => urlRX.regex.test(url));
},
express: (targetString) => {
const urlRX = pathToRegexp(targetString);
return debuggableUrlFunc((url) => urlRX.test(getPath(url)));
const urlRX = regexparam.parse(targetString);
return debuggableUrlFunc((url) => urlRX.pattern.test(getPath(url)));
},

@@ -146,11 +146,10 @@ path: (targetString) =>

const expectedKeys = Object.keys(expectedParams);
const keys = [];
const re = pathToRegexp(matcherUrl.replace(/^express:/, ''), keys);
const re = regexparam.parse(matcherUrl.replace(/^express:/, ''));
return (url) => {
debug('Attempting to match path parameters');
const vals = re.exec(getPath(url)) || [];
const vals = re.pattern.exec(getPath(url)) || [];
vals.shift();
const params = keys.reduce(
(map, { name }, i) =>
vals[i] ? Object.assign(map, { [name]: vals[i] }) : map,
const params = re.keys.reduce(
(map, paramName, i) =>
vals[i] ? Object.assign(map, { [paramName]: vals[i] }) : map,
{},

@@ -157,0 +156,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