https://github.com/alexmacarthur/map-everything
Add a map() method to the prototypes of Object, String, Set, and Map.
https://github.com/alexmacarthur/map-everything
array-manipulations javascript js map protoype
Last synced: 15 days ago
JSON representation
Add a map() method to the prototypes of Object, String, Set, and Map.
- Host: GitHub
- URL: https://github.com/alexmacarthur/map-everything
- Owner: alexmacarthur
- Created: 2019-06-20T00:49:05.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T00:48:04.000Z (over 2 years ago)
- Last Synced: 2025-03-14T11:47:21.437Z (about 1 month ago)
- Topics: array-manipulations, javascript, js, map, protoype
- Language: JavaScript
- Size: 1.33 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Map Everything!
Add a `.map()` method to the prototypes of Object, String, Set, and Map.
## See the Blog Post
This project was the result of me experimenting with adding `.map()` to JavaScript entities that don't come with it out of the box, as documented here:
[https://macarthur.me/posts/creating-a-map-method-for-objects-strings-sets-and-maps](https://macarthur.me/posts/creating-a-map-method-for-objects-strings-sets-and-maps)
## Installation
`npm install map-everything`
## Usage
Import one or several of the following methods from the `map-everything` package, which will add a `map()` method to the prototypes of the respective entities.
```javascript
import {
attachToObjectPrototype,
attachToStringPrototype,
attachToSetPrototype,
attachToMapPrototype
} from "map-everything";attachToObjectPrototype();
attachToStringPrototype();
attachToSetPrototype();
attachToMapPrototype();
```You may also attach `map()` to _all_ of these prototypes by importing the `mapEverything()` method:
```javascript
import mapEverything from "map-everything";mapEverything();
```## Why would I use this?
I'll leave that up to you.
## License
MIT © [Alex MacArthur](https://macarthur.me)