Creates a new Array or String containing a subset (slice) of the elements.

All behavior is based on the expected behavior of the JavaScript API Array.prototype.slice() and String.prototype.slice().

When operating on an Array, the returned Array is always a copy even when all the elements are being returned.

When operating on a blank value, the pipe returns the blank value.

Type Parameters

  • T

Implements

Constructors

Methods

Constructors

Methods

  • Parameters

    • input: readonly T[]
    • start: number

      the starting index of the subset to return:

      • a positive integer: return the item at start index and all items after in the list or string expression.
      • a negative integer: return the item at start index from the end and all items after in the list or string expression.
      • if positive and greater than the size of the expression: return an empty list or string.
      • if negative and greater than the size of the expression: return entire list or string.
    • Optionalend: number

      the ending index of the subset to return:

      • omitted: return all items until the end.
      • if positive: return all items before end index of the list or string.
      • if negative: return all items before end index from the end of the list or string.

    Returns T[]

  • Parameters

    • input: undefined | null
    • start: number

      the starting index of the subset to return:

      • a positive integer: return the item at start index and all items after in the list or string expression.
      • a negative integer: return the item at start index from the end and all items after in the list or string expression.
      • if positive and greater than the size of the expression: return an empty list or string.
      • if negative and greater than the size of the expression: return entire list or string.
    • Optionalend: number

      the ending index of the subset to return:

      • omitted: return all items until the end.
      • if positive: return all items before end index of the list or string.
      • if negative: return all items before end index from the end of the list or string.

    Returns null

  • Parameters

    • input: undefined | null | readonly T[]
    • start: number

      the starting index of the subset to return:

      • a positive integer: return the item at start index and all items after in the list or string expression.
      • a negative integer: return the item at start index from the end and all items after in the list or string expression.
      • if positive and greater than the size of the expression: return an empty list or string.
      • if negative and greater than the size of the expression: return entire list or string.
    • Optionalend: number

      the ending index of the subset to return:

      • omitted: return all items until the end.
      • if positive: return all items before end index of the list or string.
      • if negative: return all items before end index from the end of the list or string.

    Returns null | T[]

  • Parameters

    • input: string
    • start: number

      the starting index of the subset to return:

      • a positive integer: return the item at start index and all items after in the list or string expression.
      • a negative integer: return the item at start index from the end and all items after in the list or string expression.
      • if positive and greater than the size of the expression: return an empty list or string.
      • if negative and greater than the size of the expression: return entire list or string.
    • Optionalend: number

      the ending index of the subset to return:

      • omitted: return all items until the end.
      • if positive: return all items before end index of the list or string.
      • if negative: return all items before end index from the end of the list or string.

    Returns string

  • Parameters

    • input: undefined | null | string
    • start: number

      the starting index of the subset to return:

      • a positive integer: return the item at start index and all items after in the list or string expression.
      • a negative integer: return the item at start index from the end and all items after in the list or string expression.
      • if positive and greater than the size of the expression: return an empty list or string.
      • if negative and greater than the size of the expression: return entire list or string.
    • Optionalend: number

      the ending index of the subset to return:

      • omitted: return all items until the end.
      • if positive: return all items before end index of the list or string.
      • if negative: return all items before end index from the end of the list or string.

    Returns null | string