@macroforge/mcp-server 0.1.65 → 0.1.72

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.
Files changed (86) hide show
  1. package/README.md +7 -4
  2. package/dist/index.js +3 -3
  3. package/dist/index.js.map +1 -1
  4. package/dist/tools/docs-loader.d.ts.map +1 -1
  5. package/dist/tools/docs-loader.js +1 -1
  6. package/dist/tools/docs-loader.js.map +1 -1
  7. package/dist/tools/index.d.ts.map +1 -1
  8. package/dist/tools/index.js +84 -85
  9. package/dist/tools/index.js.map +1 -1
  10. package/docs/BOOK.md +8 -33
  11. package/docs/api/api-overview.md +4 -4
  12. package/docs/api/expand-sync.md +3 -2
  13. package/docs/api/native-plugin.md +5 -2
  14. package/docs/api/position-mapper.md +7 -4
  15. package/docs/api/transform-sync.md +7 -5
  16. package/docs/builtin-macros/deserialize/all-options.md +7 -21
  17. package/docs/builtin-macros/deserialize/combining-with-serialize.md +7 -5
  18. package/docs/builtin-macros/deserialize/enum-support.md +8 -6
  19. package/docs/builtin-macros/deserialize/error-handling.md +10 -9
  20. package/docs/builtin-macros/deserialize/interface-support.md +9 -4
  21. package/docs/builtin-macros/deserialize/runtime-validation.md +10 -21
  22. package/docs/builtin-macros/deserialize/serde-options.md +19 -31
  23. package/docs/builtin-macros/deserialize/type-alias-support.md +7 -6
  24. package/docs/builtin-macros/macros-overview/detailed-documentation.md +9 -9
  25. package/docs/builtin-macros/macros-overview/enum-support.md +3 -2
  26. package/docs/builtin-macros/macros-overview/interface-support.md +3 -2
  27. package/docs/builtin-macros/macros-overview/overview.md +13 -12
  28. package/docs/builtin-macros/macros-overview/type-alias-support.md +3 -2
  29. package/docs/builtin-macros/macros-overview.md +27 -23
  30. package/docs/builtin-macros/partial-eq/example.md +188 -232
  31. package/docs/builtin-macros/partial-eq/overview.md +18 -18
  32. package/docs/builtin-macros/serialize/example.md +11 -3
  33. package/docs/builtin-macros/serialize/overview.md +12 -11
  34. package/docs/builtin-macros/serialize/type-specific-serialization.md +12 -12
  35. package/docs/concepts/architecture.md +23 -22
  36. package/docs/concepts/derive-system/built-in-vs-custom-macros.md +4 -3
  37. package/docs/concepts/derive-system/overview.md +27 -24
  38. package/docs/concepts/derive-system.md +31 -27
  39. package/docs/concepts/how-macros-work.md +23 -21
  40. package/docs/custom-macros/custom-overview.md +9 -8
  41. package/docs/custom-macros/rust-setup.md +11 -10
  42. package/docs/custom-macros/ts-macro-derive/accessing-field-data.md +2 -1
  43. package/docs/custom-macros/ts-macro-derive/adding-imports.md +2 -1
  44. package/docs/custom-macros/ts-macro-derive/attribute-options.md +1 -1
  45. package/docs/custom-macros/ts-macro-derive/complete-example.md +1 -1
  46. package/docs/custom-macros/ts-macro-derive/deriveinput-structure.md +1 -1
  47. package/docs/custom-macros/ts-macro-derive/function-signature.md +1 -1
  48. package/docs/custom-macros/ts-macro-derive/overview.md +3 -2
  49. package/docs/custom-macros/ts-macro-derive/parsing-input.md +1 -1
  50. package/docs/custom-macros/ts-macro-derive/returning-errors.md +1 -1
  51. package/docs/custom-macros/ts-macro-derive.md +7 -4
  52. package/docs/custom-macros/ts-quote/backtick-template-literals.md +5 -3
  53. package/docs/custom-macros/ts-quote/comments-and.md +3 -2
  54. package/docs/custom-macros/ts-quote/complete-example-json-derive-macro.md +12 -11
  55. package/docs/custom-macros/ts-quote/conditionals-ifif.md +1 -1
  56. package/docs/custom-macros/ts-quote/identifier-concatenation-content.md +5 -3
  57. package/docs/custom-macros/ts-quote/interpolation-expr.md +18 -11
  58. package/docs/custom-macros/ts-quote/iteration-for.md +1 -1
  59. package/docs/custom-macros/ts-quote/local-constants-let.md +1 -1
  60. package/docs/custom-macros/ts-quote/match-expressions-match.md +1 -1
  61. package/docs/custom-macros/ts-quote/overview.md +4 -2
  62. package/docs/custom-macros/ts-quote/pattern-matching-if-let.md +2 -2
  63. package/docs/custom-macros/ts-quote/pattern-matching-iflet.md +1 -1
  64. package/docs/custom-macros/ts-quote/quick-reference.md +24 -23
  65. package/docs/custom-macros/ts-quote/side-effects-do.md +6 -5
  66. package/docs/custom-macros/ts-quote/string-interpolation-text-expr.md +3 -3
  67. package/docs/custom-macros/ts-quote/string-interpolation-textexpr.md +1 -1
  68. package/docs/custom-macros/ts-quote/tsstream-injection-typescript.md +3 -2
  69. package/docs/custom-macros/ts-quote/while-loops-while.md +1 -1
  70. package/docs/custom-macros/ts-quote.md +30 -19
  71. package/docs/getting-started/first-macro.md +5 -4
  72. package/docs/getting-started/installation.md +20 -17
  73. package/docs/integration/cli.md +11 -5
  74. package/docs/integration/configuration.md +7 -9
  75. package/docs/integration/integration-overview.md +5 -5
  76. package/docs/integration/mcp-server.md +17 -8
  77. package/docs/integration/svelte-preprocessor.md +18 -14
  78. package/docs/integration/typescript-plugin.md +14 -12
  79. package/docs/integration/vite-plugin.md +13 -11
  80. package/docs/language-servers/ls-overview.md +18 -12
  81. package/docs/language-servers/svelte-ls.md +9 -11
  82. package/docs/language-servers/svelte.md +18 -17
  83. package/docs/language-servers/zed-extensions.md +14 -11
  84. package/docs/language-servers/zed.md +19 -13
  85. package/docs/roadmap/roadmap.md +8 -6
  86. package/package.json +5 -5
@@ -1,20 +1,21 @@
1
1
  # Built-in Macros
2
2
 
3
- Macroforge comes with built-in derive macros that cover the most common code generation needs. All macros work with classes, interfaces, enums, and type aliases.
3
+ Macroforge comes with built-in derive macros that cover the most common code generation needs. All
4
+ macros work with classes, interfaces, enums, and type aliases.
4
5
 
5
6
  ## Overview
6
7
 
7
- | Macro | Generates | Description |
8
- | --------------------------------------------------- | ----------------------------------------- | --------------------------------------- |
9
- | [`Debug`](../docs/builtin-macros/debug) | `toString(): string` | Human-readable string representation |
10
- | [`Clone`](../docs/builtin-macros/clone) | `clone(): T` | Creates a deep copy of the object |
11
- | [`Default`](../docs/builtin-macros/default) | `static default(): T` | Creates an instance with default values |
12
- | [`Hash`](../docs/builtin-macros/hash) | `hashCode(): number` | Generates a hash code for the object |
13
- | [`PartialEq`](../docs/builtin-macros/partial-eq) | `equals(other: T): boolean` | Value equality comparison |
14
- | [`Ord`](../docs/builtin-macros/ord) | `compare(other: T): number` | Total ordering comparison (-1, 0, 1) |
8
+ | Macro | Generates | Description |
9
+ | --------------------------------------------------- | ---------------------------------------------- | --------------------------------------- |
10
+ | [`Debug`](../docs/builtin-macros/debug) | `toString(): string` | Human-readable string representation |
11
+ | [`Clone`](../docs/builtin-macros/clone) | `clone(): T` | Creates a deep copy of the object |
12
+ | [`Default`](../docs/builtin-macros/default) | `static default(): T` | Creates an instance with default values |
13
+ | [`Hash`](../docs/builtin-macros/hash) | `hashCode(): number` | Generates a hash code for the object |
14
+ | [`PartialEq`](../docs/builtin-macros/partial-eq) | `equals(other: T): boolean` | Value equality comparison |
15
+ | [`Ord`](../docs/builtin-macros/ord) | `compare(other: T): number` | Total ordering comparison (-1, 0, 1) |
15
16
  | [`PartialOrd`](../docs/builtin-macros/partial-ord) | `partialCompare(other: T): number | null` | Partial ordering comparison |
16
- | [`Serialize`](../docs/builtin-macros/serialize) | `toJSON(): Record<string, unknown>` | JSON serialization with type handling |
17
- | [`Deserialize`](../docs/builtin-macros/deserialize) | `static fromJSON(data: unknown): T` | JSON deserialization with validation |
17
+ | [`Serialize`](../docs/builtin-macros/serialize) | `toJSON(): Record<string, unknown>` | JSON serialization with type handling |
18
+ | [`Deserialize`](../docs/builtin-macros/deserialize) | `static fromJSON(data: unknown): T` | JSON deserialization with validation |
18
19
 
19
20
  ## Using Built-in Macros
20
21
 
@@ -33,4 +34,4 @@ class User {
33
34
      this.age = age;
34
35
    }
35
36
  }
36
- ```
37
+ ```
@@ -1,6 +1,7 @@
1
1
  ## Type Alias Support
2
2
 
3
- All built-in macros work with type aliases. For object type aliases, field-aware methods are generated in a namespace:
3
+ All built-in macros work with type aliases. For object type aliases, field-aware methods are
4
+ generated in a namespace:
4
5
 
5
6
  TypeScript
6
7
 
@@ -59,4 +60,4 @@ console.log(copy.name); // "Alice"
59
60
 
60
61
  // Eq
61
62
  console.log(user.equals(copy)); // true
62
- ```
63
+ ```
@@ -1,20 +1,21 @@
1
1
  # Built-in Macros
2
2
 
3
- Macroforge comes with built-in derive macros that cover the most common code generation needs. All macros work with classes, interfaces, enums, and type aliases.
3
+ Macroforge comes with built-in derive macros that cover the most common code generation needs. All
4
+ macros work with classes, interfaces, enums, and type aliases.
4
5
 
5
6
  ## Overview
6
7
 
7
- | Macro | Generates | Description |
8
- | --------------------------------------------------- | ----------------------------------------- | --------------------------------------- |
9
- | [`Debug`](../docs/builtin-macros/debug) | `toString(): string` | Human-readable string representation |
10
- | [`Clone`](../docs/builtin-macros/clone) | `clone(): T` | Creates a deep copy of the object |
11
- | [`Default`](../docs/builtin-macros/default) | `static default(): T` | Creates an instance with default values |
12
- | [`Hash`](../docs/builtin-macros/hash) | `hashCode(): number` | Generates a hash code for the object |
13
- | [`PartialEq`](../docs/builtin-macros/partial-eq) | `equals(other: T): boolean` | Value equality comparison |
14
- | [`Ord`](../docs/builtin-macros/ord) | `compare(other: T): number` | Total ordering comparison (-1, 0, 1) |
8
+ | Macro | Generates | Description |
9
+ | --------------------------------------------------- | ---------------------------------------------- | --------------------------------------- |
10
+ | [`Debug`](../docs/builtin-macros/debug) | `toString(): string` | Human-readable string representation |
11
+ | [`Clone`](../docs/builtin-macros/clone) | `clone(): T` | Creates a deep copy of the object |
12
+ | [`Default`](../docs/builtin-macros/default) | `static default(): T` | Creates an instance with default values |
13
+ | [`Hash`](../docs/builtin-macros/hash) | `hashCode(): number` | Generates a hash code for the object |
14
+ | [`PartialEq`](../docs/builtin-macros/partial-eq) | `equals(other: T): boolean` | Value equality comparison |
15
+ | [`Ord`](../docs/builtin-macros/ord) | `compare(other: T): number` | Total ordering comparison (-1, 0, 1) |
15
16
  | [`PartialOrd`](../docs/builtin-macros/partial-ord) | `partialCompare(other: T): number &#124; null` | Partial ordering comparison |
16
- | [`Serialize`](../docs/builtin-macros/serialize) | `toJSON(): Record<string, unknown>` | JSON serialization with type handling |
17
- | [`Deserialize`](../docs/builtin-macros/deserialize) | `static fromJSON(data: unknown): T` | JSON deserialization with validation |
17
+ | [`Serialize`](../docs/builtin-macros/serialize) | `toJSON(): Record<string, unknown>` | JSON serialization with type handling |
18
+ | [`Deserialize`](../docs/builtin-macros/deserialize) | `static fromJSON(data: unknown): T` | JSON deserialization with validation |
18
19
 
19
20
  ## Using Built-in Macros
20
21
 
@@ -37,7 +38,8 @@ class User {
37
38
 
38
39
  ## Interface Support
39
40
 
40
- All built-in macros work with interfaces. For interfaces, methods are generated as functions in a namespace with the same name, using `self` as the first parameter:
41
+ All built-in macros work with interfaces. For interfaces, methods are generated as functions in a
42
+ namespace with the same name, using `self` as the first parameter:
41
43
 
42
44
  TypeScript
43
45
 
@@ -66,7 +68,8 @@ console.log(Point.equals(point, copy)); // true
66
68
 
67
69
  ## Enum Support
68
70
 
69
- All built-in macros work with enums. For enums, methods are generated as functions in a namespace with the same name:
71
+ All built-in macros work with enums. For enums, methods are generated as functions in a namespace
72
+ with the same name:
70
73
 
71
74
  TypeScript
72
75
 
@@ -97,7 +100,8 @@ const parsed = Status.fromJSON("active");        // Status.Active
97
100
 
98
101
  ## Type Alias Support
99
102
 
100
- All built-in macros work with type aliases. For object type aliases, field-aware methods are generated in a namespace:
103
+ All built-in macros work with type aliases. For object type aliases, field-aware methods are
104
+ generated in a namespace:
101
105
 
102
106
  TypeScript
103
107
 
@@ -162,12 +166,12 @@ console.log(user.equals(copy)); // true
162
166
 
163
167
  Each macro has its own options and behaviors:
164
168
 
165
- * [**Debug**](../docs/builtin-macros/debug) - Customizable field renaming and skipping
166
- * [**Clone**](../docs/builtin-macros/clone) - Deep copying for all field types
167
- * [**Default**](../docs/builtin-macros/default) - Default value generation with field attributes
168
- * [**Hash**](../docs/builtin-macros/hash) - Hash code generation for use in maps and sets
169
- * [**PartialEq**](../docs/builtin-macros/partial-eq) - Value-based equality comparison
170
- * [**Ord**](../docs/builtin-macros/ord) - Total ordering for sorting
171
- * [**PartialOrd**](../docs/builtin-macros/partial-ord) - Partial ordering comparison
172
- * [**Serialize**](../docs/builtin-macros/serialize) - JSON serialization with serde-style options
173
- * [**Deserialize**](../docs/builtin-macros/deserialize) - JSON deserialization with validation
169
+ - [**Debug**](../docs/builtin-macros/debug) - Customizable field renaming and skipping
170
+ - [**Clone**](../docs/builtin-macros/clone) - Deep copying for all field types
171
+ - [**Default**](../docs/builtin-macros/default) - Default value generation with field attributes
172
+ - [**Hash**](../docs/builtin-macros/hash) - Hash code generation for use in maps and sets
173
+ - [**PartialEq**](../docs/builtin-macros/partial-eq) - Value-based equality comparison
174
+ - [**Ord**](../docs/builtin-macros/ord) - Total ordering for sorting
175
+ - [**PartialOrd**](../docs/builtin-macros/partial-ord) - Partial ordering comparison
176
+ - [**Serialize**](../docs/builtin-macros/serialize) - JSON serialization with serde-style options
177
+ - [**Deserialize**](../docs/builtin-macros/deserialize) - JSON deserialization with validation
@@ -30,27 +30,23 @@ class User {
30
30
 
31
31
  hashCode(): number {
32
32
  let hash = 17;
33
- hash =
34
- (hash * 31 +
35
- (Number.isInteger(this.id)
36
- ? this.id | 0
37
- : this.id
38
- .toString()
39
- .split('')
40
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
41
- 0;
42
- hash =
43
- (hash * 31 +
44
- (this.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
45
- 0;
46
- hash =
47
- (hash * 31 +
48
- (Number.isInteger(this.cachedScore)
49
- ? this.cachedScore | 0
50
- : this.cachedScore
51
- .toString()
52
- .split('')
53
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
33
+ hash = (hash * 31 +
34
+ (Number.isInteger(this.id) ? this.id | 0 : this.id
35
+ .toString()
36
+ .split('')
37
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
38
+ 0;
39
+ hash = (hash * 31 +
40
+ (this.name ?? '').split('').reduce(
41
+ (h, c) => (h * 31 + c.charCodeAt(0)) | 0,
42
+ 0
43
+ )) |
44
+ 0;
45
+ hash = (hash * 31 +
46
+ (Number.isInteger(this.cachedScore) ? this.cachedScore | 0 : this.cachedScore
47
+ .toString()
48
+ .split('')
49
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
54
50
  0;
55
51
  return hash;
56
52
  }
@@ -77,27 +73,23 @@ class User {
77
73
 
78
74
  hashCode(): number {
79
75
  let hash = 17;
80
- hash =
81
- (hash * 31 +
82
- (Number.isInteger(this.id)
83
- ? this.id | 0
84
- : this.id
85
- .toString()
86
- .split('')
87
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
88
- 0;
89
- hash =
90
- (hash * 31 +
91
- (this.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
92
- 0;
93
- hash =
94
- (hash * 31 +
95
- (Number.isInteger(this.cachedScore)
96
- ? this.cachedScore | 0
97
- : this.cachedScore
98
- .toString()
99
- .split('')
100
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
76
+ hash = (hash * 31 +
77
+ (Number.isInteger(this.id) ? this.id | 0 : this.id
78
+ .toString()
79
+ .split('')
80
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
81
+ 0;
82
+ hash = (hash * 31 +
83
+ (this.name ?? '').split('').reduce(
84
+ (h, c) => (h * 31 + c.charCodeAt(0)) | 0,
85
+ 0
86
+ )) |
87
+ 0;
88
+ hash = (hash * 31 +
89
+ (Number.isInteger(this.cachedScore) ? this.cachedScore | 0 : this.cachedScore
90
+ .toString()
91
+ .split('')
92
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
101
93
  0;
102
94
  return hash;
103
95
  }
@@ -122,27 +114,23 @@ class User {
122
114
 
123
115
  hashCode(): number {
124
116
  let hash = 17;
125
- hash =
126
- (hash * 31 +
127
- (Number.isInteger(this.id)
128
- ? this.id | 0
129
- : this.id
130
- .toString()
131
- .split('')
132
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
133
- 0;
134
- hash =
135
- (hash * 31 +
136
- (this.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
137
- 0;
138
- hash =
139
- (hash * 31 +
140
- (Number.isInteger(this.cachedScore)
141
- ? this.cachedScore | 0
142
- : this.cachedScore
143
- .toString()
144
- .split('')
145
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
117
+ hash = (hash * 31 +
118
+ (Number.isInteger(this.id) ? this.id | 0 : this.id
119
+ .toString()
120
+ .split('')
121
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
122
+ 0;
123
+ hash = (hash * 31 +
124
+ (this.name ?? '').split('').reduce(
125
+ (h, c) => (h * 31 + c.charCodeAt(0)) | 0,
126
+ 0
127
+ )) |
128
+ 0;
129
+ hash = (hash * 31 +
130
+ (Number.isInteger(this.cachedScore) ? this.cachedScore | 0 : this.cachedScore
131
+ .toString()
132
+ .split('')
133
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
146
134
  0;
147
135
  return hash;
148
136
  }
@@ -169,27 +157,23 @@ class User {
169
157
 
170
158
  hashCode(): number {
171
159
  let hash = 17;
172
- hash =
173
- (hash * 31 +
174
- (Number.isInteger(this.id)
175
- ? this.id | 0
176
- : this.id
177
- .toString()
178
- .split('')
179
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
180
- 0;
181
- hash =
182
- (hash * 31 +
183
- (this.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
184
- 0;
185
- hash =
186
- (hash * 31 +
187
- (Number.isInteger(this.cachedScore)
188
- ? this.cachedScore | 0
189
- : this.cachedScore
190
- .toString()
191
- .split('')
192
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
160
+ hash = (hash * 31 +
161
+ (Number.isInteger(this.id) ? this.id | 0 : this.id
162
+ .toString()
163
+ .split('')
164
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
165
+ 0;
166
+ hash = (hash * 31 +
167
+ (this.name ?? '').split('').reduce(
168
+ (h, c) => (h * 31 + c.charCodeAt(0)) | 0,
169
+ 0
170
+ )) |
171
+ 0;
172
+ hash = (hash * 31 +
173
+ (Number.isInteger(this.cachedScore) ? this.cachedScore | 0 : this.cachedScore
174
+ .toString()
175
+ .split('')
176
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
193
177
  0;
194
178
  return hash;
195
179
  }
@@ -214,27 +198,23 @@ class User {
214
198
 
215
199
  hashCode(): number {
216
200
  let hash = 17;
217
- hash =
218
- (hash * 31 +
219
- (Number.isInteger(this.id)
220
- ? this.id | 0
221
- : this.id
222
- .toString()
223
- .split('')
224
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
225
- 0;
226
- hash =
227
- (hash * 31 +
228
- (this.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
229
- 0;
230
- hash =
231
- (hash * 31 +
232
- (Number.isInteger(this.cachedScore)
233
- ? this.cachedScore | 0
234
- : this.cachedScore
235
- .toString()
236
- .split('')
237
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
201
+ hash = (hash * 31 +
202
+ (Number.isInteger(this.id) ? this.id | 0 : this.id
203
+ .toString()
204
+ .split('')
205
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
206
+ 0;
207
+ hash = (hash * 31 +
208
+ (this.name ?? '').split('').reduce(
209
+ (h, c) => (h * 31 + c.charCodeAt(0)) | 0,
210
+ 0
211
+ )) |
212
+ 0;
213
+ hash = (hash * 31 +
214
+ (Number.isInteger(this.cachedScore) ? this.cachedScore | 0 : this.cachedScore
215
+ .toString()
216
+ .split('')
217
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
238
218
  0;
239
219
  return hash;
240
220
  }
@@ -261,27 +241,23 @@ class User {
261
241
 
262
242
  hashCode(): number {
263
243
  let hash = 17;
264
- hash =
265
- (hash * 31 +
266
- (Number.isInteger(this.id)
267
- ? this.id | 0
268
- : this.id
269
- .toString()
270
- .split('')
271
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
272
- 0;
273
- hash =
274
- (hash * 31 +
275
- (this.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
276
- 0;
277
- hash =
278
- (hash * 31 +
279
- (Number.isInteger(this.cachedScore)
280
- ? this.cachedScore | 0
281
- : this.cachedScore
282
- .toString()
283
- .split('')
284
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
244
+ hash = (hash * 31 +
245
+ (Number.isInteger(this.id) ? this.id | 0 : this.id
246
+ .toString()
247
+ .split('')
248
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
249
+ 0;
250
+ hash = (hash * 31 +
251
+ (this.name ?? '').split('').reduce(
252
+ (h, c) => (h * 31 + c.charCodeAt(0)) | 0,
253
+ 0
254
+ )) |
255
+ 0;
256
+ hash = (hash * 31 +
257
+ (Number.isInteger(this.cachedScore) ? this.cachedScore | 0 : this.cachedScore
258
+ .toString()
259
+ .split('')
260
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
285
261
  0;
286
262
  return hash;
287
263
  }
@@ -306,27 +282,23 @@ class User {
306
282
 
307
283
  hashCode(): number {
308
284
  let hash = 17;
309
- hash =
310
- (hash * 31 +
311
- (Number.isInteger(this.id)
312
- ? this.id | 0
313
- : this.id
314
- .toString()
315
- .split('')
316
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
317
- 0;
318
- hash =
319
- (hash * 31 +
320
- (this.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
321
- 0;
322
- hash =
323
- (hash * 31 +
324
- (Number.isInteger(this.cachedScore)
325
- ? this.cachedScore | 0
326
- : this.cachedScore
327
- .toString()
328
- .split('')
329
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
285
+ hash = (hash * 31 +
286
+ (Number.isInteger(this.id) ? this.id | 0 : this.id
287
+ .toString()
288
+ .split('')
289
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
290
+ 0;
291
+ hash = (hash * 31 +
292
+ (this.name ?? '').split('').reduce(
293
+ (h, c) => (h * 31 + c.charCodeAt(0)) | 0,
294
+ 0
295
+ )) |
296
+ 0;
297
+ hash = (hash * 31 +
298
+ (Number.isInteger(this.cachedScore) ? this.cachedScore | 0 : this.cachedScore
299
+ .toString()
300
+ .split('')
301
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
330
302
  0;
331
303
  return hash;
332
304
  }
@@ -353,27 +325,23 @@ class User {
353
325
 
354
326
  hashCode(): number {
355
327
  let hash = 17;
356
- hash =
357
- (hash * 31 +
358
- (Number.isInteger(this.id)
359
- ? this.id | 0
360
- : this.id
361
- .toString()
362
- .split('')
363
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
364
- 0;
365
- hash =
366
- (hash * 31 +
367
- (this.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
368
- 0;
369
- hash =
370
- (hash * 31 +
371
- (Number.isInteger(this.cachedScore)
372
- ? this.cachedScore | 0
373
- : this.cachedScore
374
- .toString()
375
- .split('')
376
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
328
+ hash = (hash * 31 +
329
+ (Number.isInteger(this.id) ? this.id | 0 : this.id
330
+ .toString()
331
+ .split('')
332
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
333
+ 0;
334
+ hash = (hash * 31 +
335
+ (this.name ?? '').split('').reduce(
336
+ (h, c) => (h * 31 + c.charCodeAt(0)) | 0,
337
+ 0
338
+ )) |
339
+ 0;
340
+ hash = (hash * 31 +
341
+ (Number.isInteger(this.cachedScore) ? this.cachedScore | 0 : this.cachedScore
342
+ .toString()
343
+ .split('')
344
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
377
345
  0;
378
346
  return hash;
379
347
  }
@@ -398,27 +366,23 @@ class User {
398
366
 
399
367
  hashCode(): number {
400
368
  let hash = 17;
401
- hash =
402
- (hash * 31 +
403
- (Number.isInteger(this.id)
404
- ? this.id | 0
405
- : this.id
406
- .toString()
407
- .split('')
408
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
409
- 0;
410
- hash =
411
- (hash * 31 +
412
- (this.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
413
- 0;
414
- hash =
415
- (hash * 31 +
416
- (Number.isInteger(this.cachedScore)
417
- ? this.cachedScore | 0
418
- : this.cachedScore
419
- .toString()
420
- .split('')
421
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
369
+ hash = (hash * 31 +
370
+ (Number.isInteger(this.id) ? this.id | 0 : this.id
371
+ .toString()
372
+ .split('')
373
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
374
+ 0;
375
+ hash = (hash * 31 +
376
+ (this.name ?? '').split('').reduce(
377
+ (h, c) => (h * 31 + c.charCodeAt(0)) | 0,
378
+ 0
379
+ )) |
380
+ 0;
381
+ hash = (hash * 31 +
382
+ (Number.isInteger(this.cachedScore) ? this.cachedScore | 0 : this.cachedScore
383
+ .toString()
384
+ .split('')
385
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
422
386
  0;
423
387
  return hash;
424
388
  }
@@ -445,27 +409,23 @@ class User {
445
409
 
446
410
  hashCode(): number {
447
411
  let hash = 17;
448
- hash =
449
- (hash * 31 +
450
- (Number.isInteger(this.id)
451
- ? this.id | 0
452
- : this.id
453
- .toString()
454
- .split('')
455
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
456
- 0;
457
- hash =
458
- (hash * 31 +
459
- (this.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
460
- 0;
461
- hash =
462
- (hash * 31 +
463
- (Number.isInteger(this.cachedScore)
464
- ? this.cachedScore | 0
465
- : this.cachedScore
466
- .toString()
467
- .split('')
468
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
412
+ hash = (hash * 31 +
413
+ (Number.isInteger(this.id) ? this.id | 0 : this.id
414
+ .toString()
415
+ .split('')
416
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
417
+ 0;
418
+ hash = (hash * 31 +
419
+ (this.name ?? '').split('').reduce(
420
+ (h, c) => (h * 31 + c.charCodeAt(0)) | 0,
421
+ 0
422
+ )) |
423
+ 0;
424
+ hash = (hash * 31 +
425
+ (Number.isInteger(this.cachedScore) ? this.cachedScore | 0 : this.cachedScore
426
+ .toString()
427
+ .split('')
428
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
469
429
  0;
470
430
  return hash;
471
431
  }
@@ -490,27 +450,23 @@ class User {
490
450
 
491
451
  hashCode(): number {
492
452
  let hash = 17;
493
- hash =
494
- (hash * 31 +
495
- (Number.isInteger(this.id)
496
- ? this.id | 0
497
- : this.id
498
- .toString()
499
- .split('')
500
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
501
- 0;
502
- hash =
503
- (hash * 31 +
504
- (this.name ?? '').split('').reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0)) |
505
- 0;
506
- hash =
507
- (hash * 31 +
508
- (Number.isInteger(this.cachedScore)
509
- ? this.cachedScore | 0
510
- : this.cachedScore
511
- .toString()
512
- .split('')
513
- .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
453
+ hash = (hash * 31 +
454
+ (Number.isInteger(this.id) ? this.id | 0 : this.id
455
+ .toString()
456
+ .split('')
457
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
458
+ 0;
459
+ hash = (hash * 31 +
460
+ (this.name ?? '').split('').reduce(
461
+ (h, c) => (h * 31 + c.charCodeAt(0)) | 0,
462
+ 0
463
+ )) |
464
+ 0;
465
+ hash = (hash * 31 +
466
+ (Number.isInteger(this.cachedScore) ? this.cachedScore | 0 : this.cachedScore
467
+ .toString()
468
+ .split('')
469
+ .reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 0))) |
514
470
  0;
515
471
  return hash;
516
472
  }
@@ -523,4 +479,4 @@ When implementing `PartialEq`, consider also implementing `Hash`:
523
479
 
524
480
  - **Reflexivity**: `a.equals(a)` is always true
525
481
  - **Symmetry**: `a.equals(b)` implies `b.equals(a)`
526
- - **Hash consistency**: Equal objects must have equal hash codes
482
+ - **Hash consistency**: Equal objects must have equal hash codes