Skip to content

Latest commit

 

History

History
31 lines (19 loc) · 946 Bytes

transducers.padsides.md

File metadata and controls

31 lines (19 loc) · 946 Bytes

Home > @thi.ng/transducers > padSides

padSides variable

Returns iterator of src padded with value x, repeated numLeft/numRight times (default: 1). By default both sides are padded, but can be adjusted by setting either of them to zero. numRight defaults to same value as numLeft.

Signature:

padSides: <T>(src: Iterable<T>, x: T, numLeft?: number, numRight?: number) => IterableIterator<T>

Example

Essentially, syntax sugar for:

// default
concat(repeat(x, numLeft), src, repeat(x, numRight))

// left only
concat(repeat(x, numLeft), src)

// right only
concat(src, repeat(x, numRight))