Using map() on an iterator

后端 未结 8 1802
误落风尘
误落风尘 2021-02-01 11:59

Say we have a Map: let m = new Map();, using m.values() returns a map iterator.

But I can\'t use forEach() or map() o

8条回答
  •  余生分开走
    2021-02-01 12:10

    Take a look at https://www.npmjs.com/package/fluent-iterable

    Works with all of iterables (Map, generator function, array) and async iterables.

    const map = new Map();
    ...
    console.log(fluent(map).filter(..).map(..));
    

提交回复
热议问题