fromInvocation - nodef/extra-array GitHub Wiki

Generate array from repeated function invocation.

Alternatives: from, from$. Similar: from, fromRange, fromInvocation, fromApplication.

function fromInvocation(fn, n)
// fn: function
// n:  number of values
const xarray = require('extra-array');

var n = 0;
xarray.fromInvocation(() => ++n, 4);
// → [ 1, 2, 3, 4 ]

References