Skip to content

Commit 2477b86

Browse files
📚 docs(README): Improve code sample.
1 parent b0f0a17 commit 2477b86

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ See [docs](https://iterable-iterator.github.io/mapping).
66
Parent is [js-library](https://github.com/make-github-pseudonymous-again/js-library).
77

88
```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
1721
```
1822

1923
[![License](https://img.shields.io/github/license/iterable-iterator/mapping.svg)](https://raw.githubusercontent.com/iterable-iterator/mapping/main/LICENSE)

0 commit comments

Comments
 (0)