function headimport { head } from "https://deno.land/x/prelude_js@1.2.0/head.ts"; head<T extends string>(input: `${T}${string}`): TReturns the first element of the given template literal. head(input: string): stringReturns the first element of the given string. head<T>(input: readonly [T, ...unknown[]]): TReturns the first element of the given tuple. head<T>(input: Iterable<T>): T | undefinedReturns the first element of the given iterable. Returns the first element of the given template literal. ExamplesExample 1 import { head } from "https://deno.land/x/prelude_js@$VERSION/head.ts"; import { assertEquals } from "https://deno.land/std/testing/asserts.ts"; assertEquals(head(""), ""); assertEquals(head("abc"), "a"); Type ParametersT extends stringParametersinput: `${T}${string}`Any template literal. ReturnsTReturns the first element of the given string. ExamplesExample 1 import { head } from "https://deno.land/x/prelude_js@$VERSION/head.ts"; import { assertEquals } from "https://deno.land/std/testing/asserts.ts"; assertEquals(head("" as string), ""); Parametersinput: stringAny string. ReturnsstringReturns the first element of the given tuple. ExamplesExample 1 import { head } from "https://deno.land/x/prelude_js@$VERSION/head.ts"; import { assertEquals } from "https://deno.land/std/testing/asserts.ts"; assertEquals(head([]), undefined); assertEquals(head([1, 2, 3]), 1); Type ParametersTParametersinput: readonly [T, ...unknown[]]Any tuple. ReturnsTReturns the first element of the given iterable. ExamplesExample 1 import { head } from "https://deno.land/x/prelude_js@$VERSION/head.ts"; import { assertEquals } from "https://deno.land/std/testing/asserts.ts"; assertEquals(head(new Set(["x", "y", "z"])), "x"); Type ParametersTParametersinput: Iterable<T>Any iterable. ReturnsT | undefined