Skip to content

Function.slice

github-actions[bot] edited this page Nov 18, 2026 · 4 revisions

umt / slice

Function: slice()

slice(start?, end?): <T>(array) => T[]

Defined in: Pipe/slice.ts:11

Creates a pipe operator that returns a section of an array

Parameters

start?

number

The index to start from, 0 when omitted

end?

number

The index to end before, the array length when omitted

Returns

An operator that returns the selected elements

<T>(array) => T[]

Example

pipe([1, 2, 3, 4], slice(1, 3)); // [2, 3]
pipe([1, 2, 3, 4], slice(-2)); // [3, 4]

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally