@mittwald/react-ghostmaker 1.0.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,21 @@
1
1
  import is from "@sindresorhus/is";
2
2
  import { modelIdentifiers } from "./modelIdentifier";
3
3
  import { hashObject } from "./hash";
4
- const getTargetQueryKey = (something) => {
5
- if (is.primitive(something)) {
6
- return String(something);
7
- }
4
+ const getObjectName = (something) => {
8
5
  const isObject = is.object(something);
9
6
  const isClass = is.class(something);
10
7
  const isFunction = is.function(something);
11
- const objectName = isFunction
8
+ return isFunction
12
9
  ? something.name
13
10
  : isClass || isObject
14
11
  ? something.constructor.name
15
12
  : "unknown";
13
+ };
14
+ const getTargetQueryKey = (something) => {
15
+ if (is.primitive(something)) {
16
+ return String(something);
17
+ }
18
+ const objectName = getObjectName(something);
16
19
  const thisModelIdentifiers = modelIdentifiers
17
20
  .map((fn) => fn(something))
18
21
  .filter(is.string)
@@ -26,7 +29,7 @@ const getArgKey = (arg) => {
26
29
  if (is.primitive(arg)) {
27
30
  return String(arg);
28
31
  }
29
- return hashObject(arg).toString();
32
+ return `${getObjectName(arg)}(hash:${hashObject(arg)})`;
30
33
  };
31
34
  export const queries = {
32
35
  ghostmaker: () => ["react-ghostmaker"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/react-ghostmaker",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "author": "Mittwald CM Service GmbH & Co. KG <opensource@mittwald.de>",
5
5
  "contributors": [
6
6
  "Marco Falkenberg <m.falkenberg@mittwald.de>"