Skip to content

first
62 bytes

Get the first item from a list

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']
const first = _.first(gods) // => 'ra'
const firstDefault = _.first([], 'vishnu') // => 'vishnu'