Skip to content

Instantly share code, notes, and snippets.

@jooyunghan
Created December 12, 2017 07:16
Show Gist options
  • Save jooyunghan/c46ea7248bdec657afdc19b3ed154c0c to your computer and use it in GitHub Desktop.
Save jooyunghan/c46ea7248bdec657afdc19b3ed154c0c to your computer and use it in GitHub Desktop.
function* map(values, gf) {
const result = [];
for (let i = 0; i < values.length; i++) {
result.push(yield* gf(values[i], i, values));
}
return result;
}
function* knockCodeHandler(preset) {
while (true) {
const input = yield* map(preset, function*() { return getCode(yield) });
//..
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment