Skip to content

Instantly share code, notes, and snippets.

@Higgs1
Created April 1, 2015 05:49
Show Gist options
  • Save Higgs1/3e2e4c0a3e1d547b5bd5 to your computer and use it in GitHub Desktop.
Save Higgs1/3e2e4c0a3e1d547b5bd5 to your computer and use it in GitHub Desktop.
CoffeeScript "iter" function (Python-like)
iter = (x) ->
yield from x
@Higgs1
Copy link
Author

Higgs1 commented Apr 1, 2015

Converts an Iterable (String, Array, TypedArray, Map, Set, and objects with a "@@iterator"() method; but still not Array-likes - bleh) or another Generator into a Generator. Useful for iterating over various types of things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment