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

x/fonction/common/mod.ts>tail

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

Returns all but the first element of the given list or string.

Examples

Example 1

// String
tail('hello') // 'ello'
tail('h') // ''
tail('') // ''

Example 2

tail([1, 2, 3]) // [2, 3]
tail(['hello', 'world']) // ['world']
tail(['hello']) // []
tail([]) // []

type

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