Skip to content

Instantly share code, notes, and snippets.

View alexnoz's full-sized avatar
💡

Alex Nozdriukhin alexnoz

💡
  • Third Stone from the Sun
View GitHub Profile
@alexnoz
alexnoz / .js
Last active December 12, 2017 05:38 — forked from abozhilov/.js
Merge sorted iterators
'use strict';
function* merge(iterable1, iterable2) {
let iter1 = iterable1[Symbol.iterator]();
let iter2 = iterable2[Symbol.iterator]();
let a = iter1.next();
let b = iter2.next();
while(!a.done && !b.done) {
if (a.value <= b.value) {
yield a.value;