Skip to content

last

Get the last item from a list

70 bytes

Usage

Given an array of items return the last item or a default value if no items exists.

import * as _ from 'radashi'
const fish = ['marlin', 'bass', 'trout']
const lastFish = _.last(fish) // => 'trout'
const lastItem = _.last([], 'bass') // => 'bass'