Skip to main content
Module

x/fae/dropLast.ts>dropLast

A functional module for Deno inspired from Ramda.
Latest
variable dropLast
import { dropLast } from "https://deno.land/x/fae@v1.1.1/dropLast.ts";

Returns all but last n elements of given list.

Acts as a transducer if a transformer is passed in place of list

 Fae.dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar']
 Fae.dropLast(2, ['foo', 'bar', 'baz']); //=> ['foo']
 Fae.dropLast(3, ['foo', 'bar', 'baz']); //=> []
 Fae.dropLast(4, ['foo', 'bar', 'baz']); //=> []
 Fae.dropLast(3, 'foobar');               //=> 'foo'

type

DropLast