Produces a sequence of sliding windows of fixed size over source.
Type of elements within source.
The iterable to window.
Length of each window; must be at least 1.
A deferred sequence where each element exposes one contiguous window from source.
Thrown when size is less than 1.
Re-throws any error thrown while iterating source.
Windows overlap and are yielded only after enough source elements are observed to fill size. Trailing partial windows are omitted.
const numbers = [1, 2, 3, 4, 5];const windows = windows(numbers, 3);console.log(windows.select(w => w.toArray()).toArray()); // [[1, 2, 3], [2, 3, 4], [3, 4, 5]] Copy
const numbers = [1, 2, 3, 4, 5];const windows = windows(numbers, 3);console.log(windows.select(w => w.toArray()).toArray()); // [[1, 2, 3], [2, 3, 4], [3, 4, 5]]
Produces a sequence of sliding windows of fixed size over source.