functype 0.8.65 → 0.8.67
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/LICENSE +20 -20
- package/README.md +349 -277
- package/dist/branded/index.mjs +1 -1
- package/dist/chunk-NTL4HYMA.mjs +18 -0
- package/dist/chunk-NTL4HYMA.mjs.map +1 -0
- package/dist/{chunk-DWRQQO3M.mjs → chunk-PXFJPCM7.mjs} +2 -2
- package/dist/chunk-PXFJPCM7.mjs.map +1 -0
- package/dist/{chunk-42EDYQ3O.mjs → chunk-TQJDL6YW.mjs} +2 -2
- package/dist/chunk-TQJDL6YW.mjs.map +1 -0
- package/dist/either/index.mjs +1 -1
- package/dist/fpromise/index.mjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/list/index.mjs +1 -1
- package/dist/map/index.mjs +1 -1
- package/dist/option/index.d.ts +148 -31
- package/dist/option/index.mjs +1 -1
- package/dist/set/index.mjs +1 -1
- package/dist/try/index.mjs +1 -1
- package/dist/tuple/index.mjs +1 -1
- package/package.json +4 -4
- package/dist/chunk-3KVYTZJT.mjs +0 -2
- package/dist/chunk-3KVYTZJT.mjs.map +0 -1
- package/dist/chunk-42EDYQ3O.mjs.map +0 -1
- package/dist/chunk-DWRQQO3M.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,277 +1,349 @@
|
|
|
1
|
-
# Functype
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-
[](https://github.com/jordanburke/functype/actions/workflows/pnpm-build.yml)
|
|
5
|
-
|
|
6
|
-
## A Functional Programming Library for TypeScript
|
|
7
|
-
|
|
8
|
-
Functype is a lightweight functional programming library for TypeScript, drawing inspiration from functional programming paradigms, the Scala Standard Library, and ZIO. It provides a comprehensive set of utilities and abstractions designed to facilitate functional programming within TypeScript applications.
|
|
9
|
-
|
|
10
|
-
[API Documentation](https://jordanburke.github.io/functype/)
|
|
11
|
-
|
|
12
|
-
## Core Principles
|
|
13
|
-
|
|
14
|
-
- **Immutability**: All data structures are immutable, promoting predictable and side-effect-free code
|
|
15
|
-
- **Type Safety**: Leverages TypeScript's type system to ensure compile-time safety
|
|
16
|
-
- **Composability**: Provides abstractions for building complex programs from simple components
|
|
17
|
-
- **Functional Paradigms**: Embraces concepts like monads, functors, and type classes
|
|
18
|
-
|
|
19
|
-
## Key Features
|
|
20
|
-
|
|
21
|
-
- **Option Type**: Handle nullable values with `Some` and `None` types
|
|
22
|
-
- **Either Type**: Express computation results with potential failures using `Left` and `Right`
|
|
23
|
-
- **List, Set, Map**: Immutable collection types with functional operators
|
|
24
|
-
- **Try Type**: Safely execute operations that might throw exceptions
|
|
25
|
-
- **Task**: Handle synchronous and asynchronous operations with error handling
|
|
26
|
-
- **Tuple**: Type-safe fixed-length arrays
|
|
27
|
-
- **Typeable**: Runtime type identification with compile-time safety
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
//
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
//
|
|
129
|
-
const
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
###
|
|
133
|
-
|
|
134
|
-
```typescript
|
|
135
|
-
import {
|
|
136
|
-
|
|
137
|
-
//
|
|
138
|
-
const
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
//
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
###
|
|
158
|
-
|
|
159
|
-
```typescript
|
|
160
|
-
import {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
//
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
(
|
|
212
|
-
)
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
//
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
//
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
1
|
+
# Functype
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
[](https://github.com/jordanburke/functype/actions/workflows/pnpm-build.yml)
|
|
5
|
+
|
|
6
|
+
## A Functional Programming Library for TypeScript
|
|
7
|
+
|
|
8
|
+
Functype is a lightweight functional programming library for TypeScript, drawing inspiration from functional programming paradigms, the Scala Standard Library, and ZIO. It provides a comprehensive set of utilities and abstractions designed to facilitate functional programming within TypeScript applications.
|
|
9
|
+
|
|
10
|
+
[API Documentation](https://jordanburke.github.io/functype/)
|
|
11
|
+
|
|
12
|
+
## Core Principles
|
|
13
|
+
|
|
14
|
+
- **Immutability**: All data structures are immutable, promoting predictable and side-effect-free code
|
|
15
|
+
- **Type Safety**: Leverages TypeScript's type system to ensure compile-time safety
|
|
16
|
+
- **Composability**: Provides abstractions for building complex programs from simple components
|
|
17
|
+
- **Functional Paradigms**: Embraces concepts like monads, functors, and type classes
|
|
18
|
+
|
|
19
|
+
## Key Features
|
|
20
|
+
|
|
21
|
+
- **Option Type**: Handle nullable values with `Some` and `None` types
|
|
22
|
+
- **Either Type**: Express computation results with potential failures using `Left` and `Right`
|
|
23
|
+
- **List, Set, Map**: Immutable collection types with functional operators
|
|
24
|
+
- **Try Type**: Safely execute operations that might throw exceptions
|
|
25
|
+
- **Task**: Handle synchronous and asynchronous operations with error handling
|
|
26
|
+
- **Tuple**: Type-safe fixed-length arrays
|
|
27
|
+
- **Typeable**: Runtime type identification with compile-time safety
|
|
28
|
+
- **Branded Types**: Nominal typing in TypeScript's structural type system
|
|
29
|
+
- **FPromise**: Enhanced Promise functionality with built-in error handling
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# NPM
|
|
35
|
+
npm install functype
|
|
36
|
+
|
|
37
|
+
# Yarn
|
|
38
|
+
yarn add functype
|
|
39
|
+
|
|
40
|
+
# PNPM
|
|
41
|
+
pnpm add functype
|
|
42
|
+
|
|
43
|
+
# Bun
|
|
44
|
+
bun add functype
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Bundle Size Optimization
|
|
48
|
+
|
|
49
|
+
Functype is optimized for tree-shaking and offers multiple import strategies to minimize bundle size:
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
// Selective module imports (recommended for production)
|
|
53
|
+
import { Option } from "functype/option"
|
|
54
|
+
import { Either } from "functype/either"
|
|
55
|
+
|
|
56
|
+
// Direct constructor imports (smallest bundle)
|
|
57
|
+
import { some, none } from "functype/option"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
For detailed optimization strategies, see the [Bundle Optimization Guide](docs/BUNDLE_OPTIMIZATION.md).
|
|
61
|
+
|
|
62
|
+
## Usage Examples
|
|
63
|
+
|
|
64
|
+
### Option
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { Option, Some, None } from "functype"
|
|
68
|
+
|
|
69
|
+
// Create options
|
|
70
|
+
const value = Option("hello") // Some("hello")
|
|
71
|
+
const empty = Option(null) // None
|
|
72
|
+
const explicit = Some(42) // Some(42)
|
|
73
|
+
|
|
74
|
+
// Transform values
|
|
75
|
+
const length = value.map((s) => s.length) // Some(5)
|
|
76
|
+
const nothing = empty.map((s) => s.length) // None
|
|
77
|
+
|
|
78
|
+
// Handle default values
|
|
79
|
+
const result = value.getOrElse("world") // "hello"
|
|
80
|
+
const fallback = empty.getOrElse("world") // "world"
|
|
81
|
+
|
|
82
|
+
// Conditionally filter
|
|
83
|
+
const filtered = value.filter((s) => s.length > 10) // None
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Either
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { Either, Right, Left } from "functype"
|
|
90
|
+
|
|
91
|
+
// Success case
|
|
92
|
+
const success = Right<string, number>(42)
|
|
93
|
+
// Error case
|
|
94
|
+
const failure = Left<string, number>("error")
|
|
95
|
+
|
|
96
|
+
// Transform values (map only applies to Right)
|
|
97
|
+
const doubled = success.map((x) => x * 2) // Right(84)
|
|
98
|
+
const stillError = failure.map((x) => x * 2) // Left("error")
|
|
99
|
+
|
|
100
|
+
// Handle errors
|
|
101
|
+
const value = success.getOrElse(0) // 42
|
|
102
|
+
const fallback = failure.getOrElse(0) // 0
|
|
103
|
+
|
|
104
|
+
// Pattern matching with fold
|
|
105
|
+
const result = success.fold(
|
|
106
|
+
(err) => `Error: ${err}`,
|
|
107
|
+
(val) => `Success: ${val}`,
|
|
108
|
+
) // "Success: 42"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### List
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { List } from "functype"
|
|
115
|
+
|
|
116
|
+
const numbers = List([1, 2, 3, 4])
|
|
117
|
+
|
|
118
|
+
// Transform
|
|
119
|
+
const doubled = numbers.map((x) => x * 2) // List([2, 4, 6, 8])
|
|
120
|
+
|
|
121
|
+
// Filter
|
|
122
|
+
const evens = numbers.filter((x) => x % 2 === 0) // List([2, 4])
|
|
123
|
+
|
|
124
|
+
// Reduce
|
|
125
|
+
const sum = numbers.foldLeft(0)((acc, x) => acc + x) // 10
|
|
126
|
+
|
|
127
|
+
// Add/remove elements (immutably)
|
|
128
|
+
const withFive = numbers.add(5) // List([1, 2, 3, 4, 5])
|
|
129
|
+
const without3 = numbers.remove(3) // List([1, 2, 4])
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Try
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import { Try } from "functype"
|
|
136
|
+
|
|
137
|
+
// Safely execute code that might throw
|
|
138
|
+
const result = Try(() => {
|
|
139
|
+
// Potentially throwing operation
|
|
140
|
+
return JSON.parse('{"name": "John"}')
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
// Handle success/failure
|
|
144
|
+
if (result.isSuccess()) {
|
|
145
|
+
console.log("Result:", result.get())
|
|
146
|
+
} else {
|
|
147
|
+
console.error("Error:", result.error)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Transform with map (only applies on Success)
|
|
151
|
+
const name = result.map((obj) => obj.name)
|
|
152
|
+
|
|
153
|
+
// Convert to Either
|
|
154
|
+
const either = result.toEither()
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Task
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
import { Task } from "functype"
|
|
161
|
+
|
|
162
|
+
// Synchronous operations with error handling
|
|
163
|
+
const syncResult = Task().Sync(
|
|
164
|
+
() => "success",
|
|
165
|
+
(error) => new Error(`Failed: ${error}`),
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
// Asynchronous operations
|
|
169
|
+
const asyncTask = async () => {
|
|
170
|
+
const result = await Task().Async(
|
|
171
|
+
async () => await fetchData(),
|
|
172
|
+
async (error) => new Error(`Fetch failed: ${error}`),
|
|
173
|
+
)
|
|
174
|
+
return result
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Converting promise-based functions to Task
|
|
178
|
+
const fetchUserAPI = (userId: string): Promise<User> => fetch(`/api/users/${userId}`).then((r) => r.json())
|
|
179
|
+
|
|
180
|
+
// Use the adapter pattern for seamless integration
|
|
181
|
+
const fetchUser = Task({ name: "UserFetch" }).fromPromise(fetchUserAPI)
|
|
182
|
+
|
|
183
|
+
// Later use it with standard promise patterns
|
|
184
|
+
fetchUser("user123")
|
|
185
|
+
.then((user) => console.log(user))
|
|
186
|
+
.catch((error) => console.error(error))
|
|
187
|
+
|
|
188
|
+
// Or convert Task results back to promises
|
|
189
|
+
const taskResult = Task().Sync(() => "hello world")
|
|
190
|
+
const promise = Task().toPromise(taskResult) // Promise<string>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Branded Types
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
import { Brand } from "functype/branded"
|
|
197
|
+
|
|
198
|
+
// Create branded types for stronger type safety
|
|
199
|
+
type UserId = Brand<string, "UserId">
|
|
200
|
+
type Email = Brand<string, "Email">
|
|
201
|
+
|
|
202
|
+
// Create factory functions with validation
|
|
203
|
+
const UserId = (id: string): UserId => {
|
|
204
|
+
if (!/^U\d{6}$/.test(id)) {
|
|
205
|
+
throw new Error("Invalid user ID format")
|
|
206
|
+
}
|
|
207
|
+
return id as UserId
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const Email = (email: string): Email => {
|
|
211
|
+
if (!/^[^@]+@[^@]+\.[^@]+$/.test(email)) {
|
|
212
|
+
throw new Error("Invalid email format")
|
|
213
|
+
}
|
|
214
|
+
return email as Email
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Type safety in action
|
|
218
|
+
function getUserByEmail(email: Email): User { /* ... */ }
|
|
219
|
+
|
|
220
|
+
// These calls are type-safe
|
|
221
|
+
const userId = UserId("U123456")
|
|
222
|
+
const email = Email("user@example.com")
|
|
223
|
+
const user = getUserByEmail(email) // Works
|
|
224
|
+
|
|
225
|
+
// These would be type errors
|
|
226
|
+
getUserByEmail("invalid") // Type error: Argument of type 'string' is not assignable to parameter of type 'Email'
|
|
227
|
+
getUserByEmail(userId) // Type error: Argument of type 'UserId' is not assignable to parameter of type 'Email'
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Fold
|
|
231
|
+
|
|
232
|
+
New in v0.8.66, Functype now includes a powerful `fold` operation for its monadic structures:
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
import { Option, Either, Try, List } from "functype"
|
|
236
|
+
|
|
237
|
+
// Option fold
|
|
238
|
+
const opt = Option(5)
|
|
239
|
+
const optResult = opt.fold(
|
|
240
|
+
() => "None",
|
|
241
|
+
(value) => `Some(${value})`
|
|
242
|
+
) // "Some(5)"
|
|
243
|
+
|
|
244
|
+
// Either fold
|
|
245
|
+
const either = Right<string, number>(42)
|
|
246
|
+
const eitherResult = either.fold(
|
|
247
|
+
(left) => `Left(${left})`,
|
|
248
|
+
(right) => `Right(${right})`
|
|
249
|
+
) // "Right(42)"
|
|
250
|
+
|
|
251
|
+
// Try fold
|
|
252
|
+
const tryValue = Try(() => 10)
|
|
253
|
+
const tryResult = tryValue.fold(
|
|
254
|
+
(error) => `Error: ${error.message}`,
|
|
255
|
+
(value) => `Success: ${value}`
|
|
256
|
+
) // "Success: 10"
|
|
257
|
+
|
|
258
|
+
// List fold
|
|
259
|
+
const list = List([1, 2, 3])
|
|
260
|
+
const listResult = list.foldLeft(0)((acc, num) => acc + num) // 6
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Type Safety
|
|
264
|
+
|
|
265
|
+
Functype leverages TypeScript's advanced type system to provide compile-time safety for functional patterns, ensuring that your code is both robust and maintainable.
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
// Type inference works seamlessly
|
|
269
|
+
const option = Option(42)
|
|
270
|
+
// Inferred as number
|
|
271
|
+
const mappedValue = option.map((x) => x.toString())
|
|
272
|
+
// Inferred as string
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Roadmap / TODO
|
|
276
|
+
|
|
277
|
+
### Missing Functionality
|
|
278
|
+
|
|
279
|
+
- [ ] Add lazy evaluation structures (LazyList/Stream)
|
|
280
|
+
- [ ] Implement Validation type for applicative validation
|
|
281
|
+
- [ ] Add Reader/State/IO monads for more functional patterns
|
|
282
|
+
- [ ] Implement lens/optics for immutable updates
|
|
283
|
+
- [ ] Expand concurrent execution utilities beyond FPromise.all
|
|
284
|
+
|
|
285
|
+
### Performance Optimizations
|
|
286
|
+
|
|
287
|
+
- [ ] Add memoization utilities
|
|
288
|
+
- [ ] Improve recursive operations for large collections
|
|
289
|
+
- [ ] Implement immutable data structures with structural sharing
|
|
290
|
+
- [ ] Add performance benchmarks
|
|
291
|
+
- [x] Optimize TreeShaking with sideEffects flag in package.json
|
|
292
|
+
- [x] Support selective module imports for smaller bundles
|
|
293
|
+
- [x] Add bundle size monitoring to CI/CD
|
|
294
|
+
|
|
295
|
+
### API Consistency
|
|
296
|
+
|
|
297
|
+
- [ ] Ensure all modules follow the Scala-inspired pattern:
|
|
298
|
+
- Constructor functions that return objects with methods
|
|
299
|
+
- Object methods for common operations
|
|
300
|
+
- Companion functions for additional utilities
|
|
301
|
+
- [x] Align Task API with other monadic structures
|
|
302
|
+
- [ ] Standardize import patterns (@ imports vs relative paths)
|
|
303
|
+
- [x] Implement consistent error handling strategy for async operations
|
|
304
|
+
|
|
305
|
+
### Testing and Documentation
|
|
306
|
+
|
|
307
|
+
- [ ] Add observable test coverage metrics
|
|
308
|
+
- [x] Implement property-based testing
|
|
309
|
+
- [ ] Expand error handling tests
|
|
310
|
+
- [ ] Add interoperability tests with other libraries
|
|
311
|
+
|
|
312
|
+
### TypeScript Improvements
|
|
313
|
+
|
|
314
|
+
- [x] Enable stricter TypeScript settings (noImplicitAny: true)
|
|
315
|
+
- [x] Add noUncheckedIndexedAccess for safer array indexing
|
|
316
|
+
- [ ] Improve support for higher-kinded types:
|
|
317
|
+
- Current type parameters work well for first-order types
|
|
318
|
+
- Expand to support type constructors as parameters (F<A> => F<B>)
|
|
319
|
+
- [x] Add branded/nominal types for stronger type safety
|
|
320
|
+
- [ ] Implement more type-level utilities (conditional types, template literals)
|
|
321
|
+
- [ ] Leverage newer TypeScript features (const type parameters, tuple manipulation)
|
|
322
|
+
|
|
323
|
+
## Contributing
|
|
324
|
+
|
|
325
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
326
|
+
|
|
327
|
+
## License
|
|
328
|
+
|
|
329
|
+
MIT License
|
|
330
|
+
|
|
331
|
+
Copyright (c) 2025 Jordan Burke
|
|
332
|
+
|
|
333
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
334
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
335
|
+
in the Software without restriction, including without limitation the rights
|
|
336
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
337
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
338
|
+
furnished to do so, subject to the following conditions:
|
|
339
|
+
|
|
340
|
+
The above copyright notice and this permission notice shall be included in all
|
|
341
|
+
copies or substantial portions of the Software.
|
|
342
|
+
|
|
343
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
344
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
345
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
346
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
347
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
348
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
349
|
+
SOFTWARE.
|
package/dist/branded/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as Brand,g as BrandedBoolean,f as BrandedNumber,e as BrandedString,d as createBrander,c as hasBrand,b as unbrand}from'../chunk-
|
|
1
|
+
export{a as Brand,g as BrandedBoolean,f as BrandedNumber,e as BrandedString,d as createBrander,c as hasBrand,b as unbrand}from'../chunk-TQJDL6YW.mjs';//# sourceMappingURL=index.mjs.map
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|