Basic usage

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

import { last } from 'radash'

const fish = ['marlin', 'bass', 'trout']

const lastFish = last(fish) // => 'trout'
const lastItem = last([], 'bass') // => 'bass' 

Testing

This _.last function is 100% covered by tests. See them and contribute at GitHub.

Source

See the source for _.last on GitHub.