conductor
Why I'm building conductorGitHub
v1.5.0
v1.5.0
  • Introduction
  • Overview
    • Introduction
    • Core concepts
  • API reference
    • always
    • append
    • apply
    • arity
    • branch
    • capitalize
    • compose
    • concat
    • curry
    • curryN
    • delay
    • dump
    • entries
    • equals
    • equalsBy
    • factory
    • filter
    • findIndex
    • flatten
    • flip
    • forEach
    • get
    • head
    • ifElse
    • identity
    • into
    • isPromise
    • iterate
    • join
    • keys
    • map
    • merge
    • mergeBy
    • next
    • not
    • pluck
    • prepend
    • random
    • reduce
    • replace
    • slice
    • some
    • split
    • take
    • then
    • toLowerCase
    • transduce
    • transformers
      • transformers/filter
      • transformers/map
    • type
    • upsert
    • values
  • Guides
    • example use cases
    • checkGuards
Powered by GitBook
On this page
  • description
  • example
  • basic example
  • using other data structures
  1. API reference

head

head :: Collection collection => Any value

description

Returns the first item in a Collection.

example

basic example

import { head } from 'conductor'

const items = ['hello', 'world']
head(items) // 'hello'

using other data structures

import { head } from 'conductor'

const map = new Map([['drumsticks', 2]])
const object = { drumsticks: 2, drummer: 'James M' }
const set = new Set(['drumsticks', 'drummer'])
head(map) // 2
head(object) // 2
head(set) // 'drumsticks'
PreviousgetNextifElse

Last updated 7 years ago