happy-rusty 1.5.0 → 1.6.1

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 (43) hide show
  1. package/CHANGELOG.md +214 -0
  2. package/LICENSE +21 -674
  3. package/README.cn.md +265 -19
  4. package/README.md +261 -21
  5. package/dist/main.cjs +382 -32
  6. package/dist/main.cjs.map +1 -1
  7. package/dist/main.mjs +374 -33
  8. package/dist/main.mjs.map +1 -1
  9. package/dist/types.d.ts +2002 -52
  10. package/package.json +38 -25
  11. package/dist/types.d.ts.map +0 -1
  12. package/docs/README.md +0 -47
  13. package/docs/functions/Err.md +0 -46
  14. package/docs/functions/Ok.md +0 -70
  15. package/docs/functions/Some.md +0 -45
  16. package/docs/functions/isOption.md +0 -35
  17. package/docs/functions/isResult.md +0 -36
  18. package/docs/functions/promiseToAsyncResult.md +0 -50
  19. package/docs/interfaces/None.md +0 -979
  20. package/docs/interfaces/Option.md +0 -857
  21. package/docs/interfaces/Result.md +0 -903
  22. package/docs/type-aliases/AsyncIOResult.md +0 -24
  23. package/docs/type-aliases/AsyncOption.md +0 -24
  24. package/docs/type-aliases/AsyncResult.md +0 -25
  25. package/docs/type-aliases/AsyncVoidIOResult.md +0 -17
  26. package/docs/type-aliases/AsyncVoidResult.md +0 -23
  27. package/docs/type-aliases/IOResult.md +0 -24
  28. package/docs/type-aliases/VoidIOResult.md +0 -17
  29. package/docs/type-aliases/VoidResult.md +0 -23
  30. package/docs/variables/None.md +0 -18
  31. package/docs/variables/RESULT_FALSE.md +0 -18
  32. package/docs/variables/RESULT_TRUE.md +0 -18
  33. package/docs/variables/RESULT_VOID.md +0 -17
  34. package/docs/variables/RESULT_ZERO.md +0 -18
  35. package/src/enum/constants.ts +0 -30
  36. package/src/enum/core.ts +0 -635
  37. package/src/enum/defines.ts +0 -45
  38. package/src/enum/extensions.ts +0 -31
  39. package/src/enum/mod.ts +0 -6
  40. package/src/enum/prelude.ts +0 -619
  41. package/src/enum/symbols.ts +0 -9
  42. package/src/enum/utils.ts +0 -27
  43. package/src/mod.ts +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,214 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.6.1] - 2025-12-19
9
+
10
+ ### Changed
11
+ - License changed from GPL-3.0 to MIT for broader adoption and easier integration
12
+
13
+ ### Added
14
+ - Navigation links (GitHub, npm, JSR) in TypeDoc documentation header
15
+
16
+ ## [1.6.0] - 2025-12-18
17
+
18
+ ### Added
19
+ - **Sync Primitives**: `Once<T>`, `Lazy<T>`, `LazyAsync<T>`, `Mutex<T>` for Rust-style synchronization
20
+ - **Control Flow**: `ControlFlow<B, C>` with `Break` and `Continue` variants
21
+ - `Symbol.toStringTag` property to all types for better type identification
22
+ - Custom `toString()` method to all types for debugging
23
+ - `isControlFlow()` type guard utility
24
+ - `isNoneOr()` and `isNoneOrAsync()` methods for Option
25
+ - `exports` field in package.json for modern Node.js module resolution
26
+ - GitHub Pages workflow for automatic API documentation deployment
27
+ - Immutability tests to verify `Object.freeze()` is working correctly
28
+ - 100% test coverage
29
+ - CHANGELOG.md with full version history
30
+
31
+ ### Changed
32
+ - All instances are now frozen with `Object.freeze()` for runtime immutability
33
+ - TypeDoc output format from Markdown to HTML for GitHub Pages compatibility
34
+ - Migrated from Deno test to Vitest
35
+ - Build process split into Vite (JS) and Rollup (dts)
36
+
37
+ ### Fixed
38
+ - Symbol property syntax and duplicate declaration issues
39
+ - Type inference improvements for `None` interface methods
40
+
41
+ ## [1.5.0] - 2024-08-11
42
+
43
+ ### Added
44
+ - Async versions of methods: `isSomeAndAsync`, `isOkAndAsync`, `isErrAndAsync`, `unwrapOrElseAsync`, `andThenAsync`, `orElseAsync`
45
+ - Async examples
46
+
47
+ ### Changed
48
+ - Updated pnpm to v9.7.0
49
+ - Updated ESLint configuration
50
+
51
+ ## [1.4.0] - 2024-08-05
52
+
53
+ ### Added
54
+ - `Ok()` constructor without arguments (similar to Rust's `Ok(())`)
55
+ - `RESULT_VOID` constant for void Result returns
56
+ - `VoidResult<E>`, `VoidIOResult`, `AsyncVoidResult<E>`, `AsyncVoidIOResult` type aliases
57
+
58
+ ## [1.3.2] - 2024-08-04
59
+
60
+ ### Changed
61
+ - Renamed `helpers` to `utils`
62
+ - Improved `@example` annotations in JSDoc
63
+
64
+ ## [1.3.1] - 2024-08-03
65
+
66
+ ### Fixed
67
+ - `map` methods now correctly return new objects instead of mutating
68
+
69
+ ### Changed
70
+ - Updated Rollup to v4.20.0
71
+
72
+ ## [1.3.0] - 2024-08-01
73
+
74
+ ### Added
75
+ - `RESULT_TRUE`, `RESULT_FALSE`, `RESULT_ZERO` constants
76
+
77
+ ### Fixed
78
+ - Circular dependency issues
79
+
80
+ ### Changed
81
+ - Reorganized code structure
82
+
83
+ ## [1.2.0] - 2024-08-01
84
+
85
+ ### Added
86
+ - `isOption()` and `isResult()` type guard utilities
87
+ - Custom string conversion for Option and Result
88
+
89
+ ### Changed
90
+ - Replaced arrow functions with normal functions for better debug experience
91
+ - Updated ESLint to v9
92
+
93
+ ## [1.1.2] - 2024-07-17
94
+
95
+ ### Added
96
+ - `asOk<F>()` and `asErr<U>()` methods for type casting
97
+
98
+ ## [1.1.1] - 2024-07-13
99
+
100
+ ### Fixed
101
+ - TypeDoc configuration issues
102
+
103
+ ### Changed
104
+ - Updated dependencies
105
+
106
+ ## [1.1.0] - 2024-06-09
107
+
108
+ ### Added
109
+ - `Option.filter()` method
110
+ - Many new Option and Result APIs
111
+ - Comprehensive code comments and documentation
112
+
113
+ ### Changed
114
+ - Improved type inference
115
+ - `Option.filter()` now returns `Option<T>` instead of boolean
116
+
117
+ ## [1.0.9] - 2024-05-14
118
+
119
+ ### Added
120
+ - Documentation for exported symbols
121
+ - README examples
122
+
123
+ ## [1.0.8] - 2024-05-13
124
+
125
+ ### Changed
126
+ - Switched from npm to pnpm
127
+ - Added GitHub Actions test workflow with Codecov
128
+
129
+ ## [1.0.7] - 2024-05-08
130
+
131
+ ### Changed
132
+ - `Some` value type changed to `NonNullable<T>`
133
+
134
+ ### Fixed
135
+ - Can now invoke `err()` from `Ok` variant
136
+
137
+ ## [1.0.6] - 2024-05-08
138
+
139
+ ### Added
140
+ - Commonly used type exports
141
+
142
+ ### Changed
143
+ - Set `type: "module"` in package.json
144
+ - Build target set to ESNext
145
+
146
+ ## [1.0.5] - 2024-05-05
147
+
148
+ ### Changed
149
+ - Throw `TypeError` instead of generic `Error`
150
+ - Switched to Rollup for building
151
+ - Added Bun support in CI
152
+
153
+ ## [1.0.4] - 2024-05-04
154
+
155
+ ### Added
156
+ - Chinese README (`README.cn.md`)
157
+ - JSR publishing workflow
158
+ - npm publishing workflows
159
+
160
+ ### Changed
161
+ - Replaced Parcel with Rollup for building
162
+ - Replaced Jest with Bun test
163
+
164
+ ## [1.0.3] - 2024-04-27
165
+
166
+ ### Added
167
+ - Installation and Examples sections in README
168
+
169
+ ### Changed
170
+ - Force return const for better type inference
171
+
172
+ ## [1.0.2] - 2024-04-26
173
+
174
+ ### Added
175
+ - JSR publishing support
176
+
177
+ ### Changed
178
+ - Improved code comments
179
+
180
+ ## [1.0.1] - 2024-04-26
181
+
182
+ ### Changed
183
+ - Replaced enum with const for better tree-shaking
184
+ - Marked package as side-effect free
185
+
186
+ ## [1.0.0] - 2024-04-24
187
+
188
+ ### Added
189
+ - Initial release
190
+ - `Option<T>` type with `Some` and `None` variants
191
+ - `Result<T, E>` type with `Ok` and `Err` variants
192
+ - Full TypeScript support
193
+ - Comprehensive API matching Rust's Option and Result
194
+
195
+ [1.6.0]: https://github.com/JiangJie/happy-rusty/compare/v1.5.0...v1.6.0
196
+ [1.5.0]: https://github.com/JiangJie/happy-rusty/compare/v1.4.0...v1.5.0
197
+ [1.4.0]: https://github.com/JiangJie/happy-rusty/compare/v1.3.2...v1.4.0
198
+ [1.3.2]: https://github.com/JiangJie/happy-rusty/compare/v1.3.1...v1.3.2
199
+ [1.3.1]: https://github.com/JiangJie/happy-rusty/compare/v1.3.0...v1.3.1
200
+ [1.3.0]: https://github.com/JiangJie/happy-rusty/compare/v1.2.0...v1.3.0
201
+ [1.2.0]: https://github.com/JiangJie/happy-rusty/compare/v1.1.2...v1.2.0
202
+ [1.1.2]: https://github.com/JiangJie/happy-rusty/compare/v1.1.1...v1.1.2
203
+ [1.1.1]: https://github.com/JiangJie/happy-rusty/compare/v1.1.0...v1.1.1
204
+ [1.1.0]: https://github.com/JiangJie/happy-rusty/compare/v1.0.9...v1.1.0
205
+ [1.0.9]: https://github.com/JiangJie/happy-rusty/compare/v1.0.8...v1.0.9
206
+ [1.0.8]: https://github.com/JiangJie/happy-rusty/compare/v1.0.7...v1.0.8
207
+ [1.0.7]: https://github.com/JiangJie/happy-rusty/compare/v1.0.6...v1.0.7
208
+ [1.0.6]: https://github.com/JiangJie/happy-rusty/compare/v1.0.5...v1.0.6
209
+ [1.0.5]: https://github.com/JiangJie/happy-rusty/compare/v1.0.4...v1.0.5
210
+ [1.0.4]: https://github.com/JiangJie/happy-rusty/compare/v1.0.3...v1.0.4
211
+ [1.0.3]: https://github.com/JiangJie/happy-rusty/compare/v1.0.2...v1.0.3
212
+ [1.0.2]: https://github.com/JiangJie/happy-rusty/compare/v1.0.1...v1.0.2
213
+ [1.0.1]: https://github.com/JiangJie/happy-rusty/compare/v1.0.0...v1.0.1
214
+ [1.0.0]: https://github.com/JiangJie/happy-rusty/releases/tag/v1.0.0