Skip to content

fromInvocation

Subhajit Sahu edited this page May 3, 2023 · 3 revisions

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

Clone this wiki locally