Skip to main content
Module

x/fun/array.ts>prepend

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function prepend
import { prepend } from "https://deno.land/x/fun@v2.0.0/array.ts";

Create a new array by prepending an item to the head of an existing array.

Examples

Example 1

import * as A from "./array.ts";
import { pipe } from "./fn.ts";

const result = pipe(
  [1, 2, 3],
  A.prepend(4),
); // [4, 1, 2, 3]

Returns

(ua: ReadonlyArray<A>) => ReadonlyArray<A>