Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "iter/pad-sides"

Index

Functions

Functions

Const padSides

  • padSides<T>(src: Iterable<T>, x: T, numLeft?: number, numRight?: number): IterableIterator<T>
  • 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.

    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))

    Type parameters

    • T

    Parameters

    • src: Iterable<T>

      -

    • x: T

      -

    • Default value numLeft: number = 1

      -

    • Default value numRight: number = numLeft

      -

    Returns IterableIterator<T>

Generated using TypeDoc