File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -6,14 +6,18 @@ See [docs](https://iterable-iterator.github.io/mapping).
6
6
Parent is [ js-library] ( https://github.com/make-github-pseudonymous-again/js-library ) .
7
7
8
8
``` js
9
- > import { constant , reflect } from ' @iterable-iterator/mapping' ;
10
- > import {enumerate } from ' @iterable-iterator/zip' ;
11
- > constant ( ' ab' , 1 )
12
- [[' a' , 1 ], [' b' , 1 ]]
13
- > reflect (enumerate (' ab' ))
14
- [[' a' , 0 ], [' b' , 1 ]]
15
- > Object .fromEntries (reflect (enumerate (' ab' )))
16
- { ' a' : 0 , ' b' : 1 }
9
+ import {constant } from ' @iterable-iterator/mapping' ;
10
+ constant (' ab' , 1 ); // ['a', 1] ['b', 1]
11
+
12
+ import {reflect } from ' @iterable-iterator/mapping' ;
13
+ import {enumerate } from ' @iterable-iterator/zip' ;
14
+ reflect (enumerate (' ab' )); // ['a', 0] ['b', 1]
15
+
16
+ // You can convert to and from Object and Map
17
+ Object .fromEntries (mapping) - > Object
18
+ Object .entries (object) - > mapping
19
+ new Map (mapping) - > Map
20
+ map .entries () - > mapping
17
21
```
18
22
19
23
[ ![ License] ( https://img.shields.io/github/license/iterable-iterator/mapping.svg )] ( https://raw.githubusercontent.com/iterable-iterator/mapping/main/LICENSE )
You can’t perform that action at this time.
0 commit comments