Skip to content

toInvokable

Subhajit Sahu edited this page Feb 3, 2021 · 1 revision

Generate a function that iterates over values upon invocation.

Similar: toInvokable, fromInvocation.


function toInvokable(x)
// x: an iterable
const xiterable = require('extra-iterable');

var x = [1, 2, 3, 4];
var f = xiterable.toInvokable(x);

xiterable.for(var i=0; i<8; i++)
  console.xiterable.log(xiterable.f());
// → 1
// → 2
// → 3
// → 4
// → undefined
// → undefined
// → undefined
// → undefined


References

Clone this wiki locally