iterflow 0.2.2 → 0.4.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 +34 -9
- package/dist/index.cjs +8 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -10
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ import { iter } from 'iterflow';
|
|
|
45
45
|
iter([1, 2, 3, 4, 5])
|
|
46
46
|
.filter(x => x > 2) // Native iterator method
|
|
47
47
|
.map(x => x * 2) // Native iterator method
|
|
48
|
-
.sum(); // iterflow extension -
|
|
48
|
+
.sum(); // iterflow extension - 24
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
### Functional API
|
|
@@ -54,7 +54,7 @@ iter([1, 2, 3, 4, 5])
|
|
|
54
54
|
import { sum, filter, map } from 'iterflow/fn';
|
|
55
55
|
|
|
56
56
|
const data = [1, 2, 3, 4, 5];
|
|
57
|
-
sum(map(x => x * 2)(filter(x => x > 2)(data))); //
|
|
57
|
+
sum(map(x => x * 2)(filter(x => x > 2)(data))); // 24
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
## Operations
|
|
@@ -62,13 +62,11 @@ sum(map(x => x * 2)(filter(x => x > 2)(data))); // 18
|
|
|
62
62
|
### Statistical
|
|
63
63
|
|
|
64
64
|
```typescript
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
numbers.variance(); // 8.25
|
|
71
|
-
numbers.percentile(75); // 7.75
|
|
65
|
+
iter([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).sum(); // 55
|
|
66
|
+
iter([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).mean(); // 5.5
|
|
67
|
+
iter([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).median(); // 5.5
|
|
68
|
+
iter([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).variance(); // 8.25
|
|
69
|
+
iter([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).percentile(75); // 7.75
|
|
72
70
|
```
|
|
73
71
|
|
|
74
72
|
### Windowing
|
|
@@ -223,6 +221,33 @@ const movingAverages = iter(temperatures)
|
|
|
223
221
|
.toArray();
|
|
224
222
|
```
|
|
225
223
|
|
|
224
|
+
<!-- BENCHMARK_SUMMARY_START -->
|
|
225
|
+
<!-- BENCHMARK_SUMMARY_END -->
|
|
226
|
+
|
|
227
|
+
## Documentation
|
|
228
|
+
|
|
229
|
+
- **[FAQ](FAQ.md)** - Frequently asked questions, common patterns, and troubleshooting
|
|
230
|
+
- **[Examples](examples/)** - Real-world usage examples
|
|
231
|
+
- **[SECURITY.md](SECURITY.md)** - Security best practices and vulnerability reporting
|
|
232
|
+
|
|
233
|
+
## Contributing
|
|
234
|
+
|
|
235
|
+
We welcome contributions! Please see our [PLAYBOOK.md](PLAYBOOK.md) for:
|
|
236
|
+
|
|
237
|
+
- Development workflow and branching strategy
|
|
238
|
+
- Commit message guidelines
|
|
239
|
+
- Testing requirements
|
|
240
|
+
- Release process
|
|
241
|
+
|
|
242
|
+
For quick start:
|
|
243
|
+
|
|
244
|
+
1. Fork the repository
|
|
245
|
+
2. Create a feature branch from `dev`
|
|
246
|
+
3. Make your changes with tests
|
|
247
|
+
4. Submit a PR to `dev`
|
|
248
|
+
|
|
249
|
+
See [PLAYBOOK.md](PLAYBOOK.md) for complete details.
|
|
250
|
+
|
|
226
251
|
## License
|
|
227
252
|
|
|
228
253
|
The Unlicense - See [LICENSE](LICENSE) for details.
|
package/dist/index.cjs
CHANGED
|
@@ -3344,19 +3344,16 @@ function asyncIter(source) {
|
|
|
3344
3344
|
function fromPromises(promises) {
|
|
3345
3345
|
return new Asynciterflow({
|
|
3346
3346
|
async *[Symbol.asyncIterator]() {
|
|
3347
|
-
const pending = new Set(promises);
|
|
3348
3347
|
const results = /* @__PURE__ */ new Map();
|
|
3349
3348
|
const indexed = promises.map((p, i) => p.then((v) => ({ i, v })));
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
nextIndex++;
|
|
3359
|
-
}
|
|
3349
|
+
await Promise.all(
|
|
3350
|
+
indexed.map(async (p) => {
|
|
3351
|
+
const result = await p;
|
|
3352
|
+
results.set(result.i, result.v);
|
|
3353
|
+
})
|
|
3354
|
+
);
|
|
3355
|
+
for (let i = 0; i < promises.length; i++) {
|
|
3356
|
+
yield results.get(i);
|
|
3360
3357
|
}
|
|
3361
3358
|
}
|
|
3362
3359
|
});
|