Deeply Iterate over Arrays. Like calling array.flat()[Symbol.iterator](), but without the memory cost
npm install flat-iterarray.flat()[Symbol.iterator](), but without the memory cost.bash
npm install flat-iter
`usage
`js
import flatIter from "flat-iter";const data = [
[123, 342, 452, 533, ...],
[1263, 432, 234, 542, ...]
];
const iterator = flatIter(data, depth);
`case study: calculating statistics
The calc-stats library calculates
statistics of an iterable of numbers. It works on flat arrays or any iterable that
returns numbers. It expects each call of next to return a number,
not an array of numbers (like a row). By using flatIter we can calculate statistics
for a table of numbers (2-D arrays).`js
// calculate statistics for 2-D Data
import calcStats from "calc-stats";// new memory-safe way
const stats = calcStats(flatIter(data));
// old way, risking memory blowing up
const stats = calcStats(data.flat());
``