How do you map over an es6 map? new Map([['key', 'value']]).map(([key, value]) => [key + 1, value + 1]) isn't implemented :(
-
-
Replying to @Vjeux
Map isn't really for that, but... var x = new Map([['a','b']); [...x].map(([k,v]) => console.log(k,v))
2 replies 0 retweets 5 likes -
Replying to @wesbos
omg, what a contrived way: new Map([...new Map([['key', 'value']])].map(([key, value]) => [key + 1, value + 1]))
3 replies 0 retweets 6 likes -
okay, time to bug my tc39 friends:
@BrendanEich,@sebmarkbage,@ljharb would this be considered for addition to the standard?2 replies 0 retweets 4 likes -
you can use map.values().map
2 replies 0 retweets 1 like -
sorry, map.entries().map
2 replies 0 retweets 1 like -
Like this? I can't get it to work (new Map([['a','b']])).entries().map(x => console.log(x))
1 reply 0 retweets 0 likes -
haha, entries returns an iterator, not an array!
3 replies 0 retweets 2 likes
you can use: > Array.from(new Map(['a', 'b'])).map
-
-
It's nicer but the temp array seems unnecessary. Iterator.prototype.map idea failed, alas.
0 replies 0 retweets 1 likeThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 