Port of Python's itertools to JavaScript.