Skip to content

identity

Returns the value passed to it

46 bytes
since v12.7.0

Usage

This is useful when you need to pass a function somewhere that simply returns the value it receives, without any modification.

import * as
import _
_
from 'radashi'
import _
_
.
function identity(): undefined (+1 overload)

A function that returns the value passed to it.

@seehttps://radashi.js.org/reference/function/identity

@example

identity() // => undefined
identity(1) // => 1
identity("a") // => "a"

@version12.7.0

identity
() // => undefined
import _
_
.
function identity<1>(value: 1): 1 (+1 overload)

A function that returns the value passed to it.

@seehttps://radashi.js.org/reference/function/identity

@example

identity() // => undefined
identity(1) // => 1
identity("a") // => "a"

@version12.7.0

identity
(1) // => 1
import _
_
.
function identity<"a">(value: "a"): "a" (+1 overload)

A function that returns the value passed to it.

@seehttps://radashi.js.org/reference/function/identity

@example

identity() // => undefined
identity(1) // => 1
identity("a") // => "a"

@version12.7.0

identity
('a') // => 'a'