functype 0.15.0 → 0.17.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.
- package/README.md +32 -41
- package/README.processed.md +871 -0
- package/dist/{Either-DwiehtBQ.d.ts → Either-CM1xSzLl.d.ts} +16 -17
- package/dist/branded/index.d.ts +12 -5
- package/dist/branded/index.mjs +1 -1
- package/dist/chunk-LW2YTB56.mjs +45 -0
- package/dist/chunk-LW2YTB56.mjs.map +1 -0
- package/dist/chunk-OR6V4TCO.mjs +2 -0
- package/dist/chunk-OR6V4TCO.mjs.map +1 -0
- package/dist/do/index.d.ts +2 -2
- package/dist/do/index.mjs +1 -1
- package/dist/either/index.d.ts +1 -1
- package/dist/either/index.mjs +1 -1
- package/dist/fpromise/index.d.ts +1 -1
- package/dist/fpromise/index.mjs +1 -1
- package/dist/index.d.ts +73 -53
- package/dist/index.mjs +1 -1
- package/dist/list/index.d.ts +1 -1
- package/dist/list/index.mjs +1 -1
- package/dist/map/index.d.ts +1 -1
- package/dist/map/index.mjs +1 -1
- package/dist/option/index.d.ts +1 -1
- package/dist/option/index.mjs +1 -1
- package/dist/set/index.d.ts +1 -1
- package/dist/set/index.mjs +1 -1
- package/dist/try/index.d.ts +1 -1
- package/dist/try/index.mjs +1 -1
- package/package.json +27 -19
- package/readme/BRAND_MIGRATION_GUIDE.md +2 -2
- package/readme/ai-guide.md +9 -9
- package/readme/examples.md +19 -19
- package/readme/quick-reference.md +6 -6
- package/dist/chunk-RUKG3LN7.mjs +0 -43
- package/dist/chunk-RUKG3LN7.mjs.map +0 -1
- package/dist/chunk-YBBRJTHY.mjs +0 -2
- package/dist/chunk-YBBRJTHY.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -68,50 +68,11 @@ For detailed optimization strategies, see the [Bundle Optimization Guide](docs/B
|
|
|
68
68
|
|
|
69
69
|
### Option
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
import { Option, Some, None } from "functype"
|
|
73
|
-
|
|
74
|
-
// Create options
|
|
75
|
-
const value = Option("hello") // Some("hello")
|
|
76
|
-
const empty = Option(null) // None
|
|
77
|
-
const explicit = Some(42) // Some(42)
|
|
78
|
-
|
|
79
|
-
// Transform values
|
|
80
|
-
const length = value.map((s) => s.length) // Some(5)
|
|
81
|
-
const nothing = empty.map((s) => s.length) // None
|
|
82
|
-
|
|
83
|
-
// Handle default values
|
|
84
|
-
const result = value.getOrElse("world") // "hello"
|
|
85
|
-
const fallback = empty.getOrElse("world") // "world"
|
|
86
|
-
|
|
87
|
-
// Conditionally filter
|
|
88
|
-
const filtered = value.filter((s) => s.length > 10) // None
|
|
89
|
-
```
|
|
71
|
+
{@includeCode test/docs/documentation-examples.spec.ts#readme-option-basic}
|
|
90
72
|
|
|
91
73
|
### Either
|
|
92
74
|
|
|
93
|
-
|
|
94
|
-
import { Either, Right, Left } from "functype"
|
|
95
|
-
|
|
96
|
-
// Success case
|
|
97
|
-
const success = Right<string, number>(42)
|
|
98
|
-
// Error case
|
|
99
|
-
const failure = Left<string, number>("error")
|
|
100
|
-
|
|
101
|
-
// Transform values (map only applies to Right)
|
|
102
|
-
const doubled = success.map((x) => x * 2) // Right(84)
|
|
103
|
-
const stillError = failure.map((x) => x * 2) // Left("error")
|
|
104
|
-
|
|
105
|
-
// Handle errors
|
|
106
|
-
const value = success.getOrElse(0) // 42
|
|
107
|
-
const fallback = failure.getOrElse(0) // 0
|
|
108
|
-
|
|
109
|
-
// Pattern matching with fold
|
|
110
|
-
const result = success.fold(
|
|
111
|
-
(err) => `Error: ${err}`,
|
|
112
|
-
(val) => `Success: ${val}`,
|
|
113
|
-
) // "Success: 42"
|
|
114
|
-
```
|
|
75
|
+
{@includeCode test/docs/documentation-examples.spec.ts#readme-either-basic}
|
|
115
76
|
|
|
116
77
|
### List
|
|
117
78
|
|
|
@@ -687,6 +648,10 @@ opt.forEach(console.log) // Logs: 42
|
|
|
687
648
|
list.forEach(console.log) // Logs: 1, 2, 3, 4, 5
|
|
688
649
|
```
|
|
689
650
|
|
|
651
|
+
## Feature Matrix
|
|
652
|
+
|
|
653
|
+
For a comprehensive overview of which interfaces are supported by each data structure, see the [Functype Feature Matrix](docs/FUNCTYPE_FEATURE_MATRIX.md).
|
|
654
|
+
|
|
690
655
|
## Type Safety
|
|
691
656
|
|
|
692
657
|
Functype leverages TypeScript's advanced type system to provide compile-time safety for functional patterns, ensuring that your code is both robust and maintainable.
|
|
@@ -835,6 +800,32 @@ For more details, see the [Error Formatting Guide](docs/error-formatting.md).
|
|
|
835
800
|
- [ ] Implement more type-level utilities (conditional types, template literals)
|
|
836
801
|
- [ ] Leverage newer TypeScript features (const type parameters, tuple manipulation)
|
|
837
802
|
|
|
803
|
+
## Claude Code Skills
|
|
804
|
+
|
|
805
|
+
Functype provides two specialized Claude Code skills to enhance your development experience:
|
|
806
|
+
|
|
807
|
+
### Functype User Guide
|
|
808
|
+
|
|
809
|
+
Help for developers using functype in their projects:
|
|
810
|
+
|
|
811
|
+
- Pattern conversion (imperative → functional)
|
|
812
|
+
- API lookup and examples
|
|
813
|
+
- Common use cases and debugging tips
|
|
814
|
+
|
|
815
|
+
**Install**: Download from [dist/skills/functype-user.zip](./dist/skills/functype-user.zip)
|
|
816
|
+
|
|
817
|
+
### Functype Library Developer
|
|
818
|
+
|
|
819
|
+
Guide for contributors developing functype itself:
|
|
820
|
+
|
|
821
|
+
- Architecture patterns and development workflow
|
|
822
|
+
- Creating new data structures
|
|
823
|
+
- Testing strategies and interface implementation
|
|
824
|
+
|
|
825
|
+
**Install**: Download from [dist/skills/functype-developer.zip](./dist/skills/functype-developer.zip)
|
|
826
|
+
|
|
827
|
+
See [.claude/skills/README.md](./.claude/skills/README.md) for complete installation and usage instructions.
|
|
828
|
+
|
|
838
829
|
## Contributing
|
|
839
830
|
|
|
840
831
|
Contributions are welcome! Please feel free to submit a Pull Request.
|