What about a method for an arbitrary-dimensional array?
[5].buildShape(i => i + 1); // [1, 2, 3, 4, 5]
[5, 7].buildShape((i, j) => i * 7 + j + 1); // [[1, 2, 3, 4, 5, 6, 7], …, [29, 30, 31, 32, 33, 34, 35]]
(Method name to be discussed)
It not only fits the original goal but also has richer features. Since there is still no API with similar functionality, it will be highly more convincing than what we have discussed.