Skip to content

first

Get the first item from a list

62 bytes

Usage

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

import * as _ from 'radashi'
const gods = ['ra', 'loki', 'zeus']
_.first(gods) // => 'ra'
_.first([], 'vishnu') // => 'vishnu'