Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/fonction/common/mod.ts>head

A modern practical functional library
Latest
variable head
import { head } from "https://deno.land/x/fonction@v2.1.0-beta.4/common/mod.ts";

Infer the head types.

Examples

Example 1

// String
head<''> // ''
head<'hello'> // 'hello'

Example 2

// Array
head<[]> // undefined
head<['hello', 'world']> // 'hello'

type

<T extends readonly unknown[] | string>(val: T) => Head<T>