Skip to content

webshrine / stdlib/src / through

Function: through()

through<T>(arg): T

A no-operation function that returns the argument it received.

Uses as mock in rare cases to satisfy types and decrease the amount of code.

Type Parameters

T

Parameters

arg

T

Returns

T

Example

ts
const order: FnWrapper = isDesc ? inverse : through
const sorter = order(compareNumbers)

[1,3,2].sort(sorter)

Defined in

packages/stdlib/src/utils/common.ts:26