Home Manual Reference Source

Function

Static Public Summary
public

window(n: number, iterable: Iterable): IterableIterator<Array>

Yields arrays that contain the current element of the input iterable and the next n-1 elements of the input iterable.

Static Private Summary
private

_window(n: number, iterable: IterableIterator): IterableIterator

Repeatedly yields the same deque that is updated to contain the current element of the input iterable iterator and the next n-1 elements of the input iterable iterator.

Static Public

public window(n: number, iterable: Iterable): IterableIterator<Array> source

Yields arrays that contain the current element of the input iterable and the next n-1 elements of the input iterable.

Params:

NameTypeAttributeDescription
n number

The window size.

iterable Iterable

The input iterable.

Return:

IterableIterator<Array>

Example:

window( 2, range( 100 ) ) ;
// is equivalent to
zip( range( 100 ) , range( 1 , 100 ) ) ;

Static Private

private _window(n: number, iterable: IterableIterator): IterableIterator source

Repeatedly yields the same deque that is updated to contain the current element of the input iterable iterator and the next n-1 elements of the input iterable iterator.

Params:

NameTypeAttributeDescription
n number

The window size.

iterable IterableIterator

The input iterable.

Return:

IterableIterator