Skip to content

Instantly share code, notes, and snippets.

@voltrevo
Last active July 25, 2017 01:02
Show Gist options
  • Save voltrevo/0a3c7a88f6f8d5ad12fc2cb04efd5e33 to your computer and use it in GitHub Desktop.
Save voltrevo/0a3c7a88f6f8d5ad12fc2cb04efd5e33 to your computer and use it in GitHub Desktop.
'use strict';
export default function mapcat(elements, fn) {
return (function* () {
for (const el of elements) {
for (const newEl of fn(el)) {
yield newEl;
}
}
})();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment