Skip to content

Commit 1fb43f2

Browse files
committed
hashing fn update
1 parent 49f5a46 commit 1fb43f2

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graphql-js-tree",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"private": false,
55
"license": "MIT",
66
"description": "GraphQL Parser providing simplier structure",

Diff for: src/TreeOperations/merge.ts

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const mergeNode = (n1: ParserField, n2: ParserField) => {
1010
const args = [...n1.args, ...n2.args.map(addFromLibrary)];
1111
const mergedNode = {
1212
...n1,
13-
id: generateNodeId(n1.name, n1.data.type, args),
1413
args,
1514
directives: [...n1.directives, ...n2.directives.map(addFromLibrary)],
1615
interfaces: [...n1.interfaces, ...n2.interfaces],

Diff for: src/shared/index.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ export const decompileType = (typeName: string): FieldType => {
5555
};
5656

5757
export const generateNodeId = (name: string, dataType: AllTypes, args: ParserField[]) => {
58-
const s = [name, dataType, isExtensionNode(dataType) ? args.map((a) => a.id).join('-') : ''].join('-');
59-
return cyrb53(s);
58+
const s = isExtensionNode(dataType)
59+
? `${name}-extend-${cyrb53(JSON.stringify(args.map((a) => a.name + a.id)))}`
60+
: name;
61+
return s;
6062
};
6163
const cyrb53 = (str: string, seed = 0) => {
6264
let h1 = 0xdeadbeef ^ seed,

0 commit comments

Comments
 (0)