Basic usage

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

import { first } from 'radash'

const gods = ['ra', 'loki', 'zeus']

first(gods) // => 'ra'
first([], 'vishnu') // => 'vishnu' 

Testing

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

Source

See the source for _.first on GitHub.