Skip to content

Function.transform

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

umt / transform

Function: transform()

transform<T, U>(function_): (input) => T extends readonly unknown[] ? U[] : U

Defined in: Pipe/transform.ts:10

Creates a pipe operator that applies a function to each element of an array, or to the value itself when the input is not an array

Type Parameters

T

T

U

U

Parameters

function_

(value) => U

The function to apply

Returns

An operator that transforms each element or the value

(input) => T extends readonly unknown[] ? U[] : U

Example

pipe([1, 2, 3], transform((x) => x * 2)); // [2, 4, 6]
pipe(2, transform((x) => x * 2)); // 4

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally