Repository: wheresrhys/fetch-mock (js)

Issue:
Rename functionMatcher to func
It's just a bit more concise

Pull request:
feat!: renamed functionMatcher to func
fixes #720 

Patch:
diff --git a/docs/docs/@fetch-mock/core/route/matcher.md b/docs/docs/@fetch-mock/core/route/matcher.md
index 8a4fc33..b9b1a7f 100644
--- a/docs/docs/@fetch-mock/core/route/matcher.md
+++ b/docs/docs/@fetch-mock/core/route/matcher.md
@@ -141,7 +141,7 @@ This option can also be [set in the global configuration](/fetch-mock/docs/@fetc
 
 For use cases not covered by all the built in matchers, a custom function can be used. It should return `true` to indicate a route should respond to a request. It will be passed the `url` and `options` `fetch` was called with. If `fetch` was called with a `Request` instance, it will be passed `url` and `options` inferred from the `Request` instance, with the original `Request` available as a third argument.
 
-As well as being passed as a standalone argument, it can also be added to the matcher object as the property `{functionMatcher: ...}` when combining with other matchers or options.
+As well as being passed as a standalone argument, it can also be added to the matcher object as the property `{func: ...}` when combining with other matchers or options.
 
 ### Examples
 
diff --git a/packages/core/src/Matchers.js b/packages/core/src/Matchers.js
index 445bde6..c24ba2f 100644
--- a/packages/core/src/Matchers.js
+++ b/packages/core/src/Matchers.js
@@ -196,7 +196,7 @@ const getFullUrlMatcher = (route, matcherUrl, query) => {
 /**
  * @type {MatcherGenerator}
  */
-const getFunctionMatcher = ({ functionMatcher }) => functionMatcher;
+const getFunctionMatcher = ({ func }) => func;
 /**
  * @type {MatcherGenerator}
  */
@@ -236,6 +236,6 @@ export const builtInMatchers = [
 	{ name: 'headers', matcher: getHeaderMatcher },
 	{ name: 'params', matcher: getParamsMatcher },
 	{ name: 'body', matcher: getBodyMatcher, usesBody: true },
-	{ name: 'functionMatcher', matcher: getFunctionMatcher },
+	{ name: 'func', matcher: getFunctionMatcher },
 	{ name: 'url', matcher: getUrlMatcher },
 ];
diff --git a/packages/core/src/Route.js b/packages/core/src/Route.js
index d32cf7e..e7c7814 100644
--- a/packages/core/src/Route.js
+++ b/packages/core/src/Route.js
@@ -41,7 +41,7 @@ import statusTextMap from './StatusTextMap';
  * @property {{ [key: string]: string }} [query]
  * @property {{ [key: string]: string }} [params]
  * @property {object} [body]
- * @property {RouteMatcherFunction} [functionMatcher]
+ * @property {RouteMatcherFunction} [func]
  * @property {RouteMatcher} [matcher]
  * @property {RouteMatcherUrl} [url]
  * @property {RouteResponse | RouteResponseFunction} [response]
@@ -139,7 +139,7 @@ class Route {
 			delete this.config.matcher;
 		}
 		if (isFunctionMatcher(this.config.matcher)) {
-			this.config.functionMatcher = this.config.matcher;
+			this.config.func = this.config.matcher;
 		}
 	}
 	/**


Test patch:
diff --git a/packages/core/src/__tests__/Matchers/function.test.js b/packages/core/src/__tests__/Matchers/function.test.js
index 0bc6d4f..46af89b 100644
--- a/packages/core/src/__tests__/Matchers/function.test.js
+++ b/packages/core/src/__tests__/Matchers/function.test.js
@@ -43,7 +43,7 @@ describe('function matching', () => {
 		const route = new Route({
 			matcher: 'end:profile',
 			response: 200,
-			functionMatcher: (url, opts) =>
+			func: (url, opts) =>
 				opts && opts.headers && opts.headers.authorized === true,
 		});
 
diff --git a/packages/core/src/__tests__/Matchers/route-config-object.test.js b/packages/core/src/__tests__/Matchers/route-config-object.test.js
index b43877c..b9ad11a 100644
--- a/packages/core/src/__tests__/Matchers/route-config-object.test.js
+++ b/packages/core/src/__tests__/Matchers/route-config-object.test.js
@@ -42,10 +42,10 @@ describe('matcher object', () => {
 	});
 
 	//TODO be strionger on discouraging this
-	it.skip('deprecated message on using functionMatcher (prefer matcher)', () => {
+	it.skip('deprecated message on using func (prefer matcher)', () => {
 		new Route({
 			url: 'end:profile',
-			functionMatcher: (url, opts) =>
+			func: (url, opts) =>
 				opts && opts.headers && opts.headers.authorized === true,
 			response: 200,
 		});