Last active
October 11, 2016 23:04
-
-
Save HugoDF/0e2493e0edf7e6087a7518a88ea78f5b to your computer and use it in GitHub Desktop.
ES6 map implementation using arrow function, recursion and destructuring
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map = ([ head, ... tail ], fn) => | |
( (head !== undefined && tail.length) ? ( tail.length ? [ fn(head), ...(map(tail, fn)) ] : [ fn(head) ] ) : []); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment