Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anywhichway/map
Map for any iterable
https://github.com/anywhichway/map
Last synced: about 4 hours ago
JSON representation
Map for any iterable
- Host: GitHub
- URL: https://github.com/anywhichway/map
- Owner: anywhichway
- License: mit
- Created: 2023-01-01T13:15:15.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-04T17:19:19.000Z (almost 2 years ago)
- Last Synced: 2024-08-08T19:54:14.730Z (3 months ago)
- Language: JavaScript
- Size: 35.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# map
Map for any iterable, promised iterable, or item that can be converted into an iterable.# Usage
```javascript
await map(item,func,what="values")
```The 'item' could be a generator, async generator, Set, etc.
# How It Works
1. awaits `item` so that if it is a Promise, it resolves
2. tries to use
1. native `map` on `item
2. `for await(value of await item)` directly on the `item`
3. `for await()` on the result of calling the method with the `what` name on item or if `what` is a function its return value when passed `item`
4. `for await()` on the result of using native `forEach`, if available on item, to collect values from `item`# Release History (Reverse Chronological Order)
2023-01-04 v1.0.0 Added unit tests, 95.83% test coverage
2023-01-01 v0.0.1 Initial public release