rubico
Version:
[a]synchronous functional programming
24 lines (23 loc) • 467 B
TypeScript
export = first;
/**
* @name first
*
* @synopsis
* ```coffeescript [specscript]
* var value Array|string
*
* first(value) -> any
* ```
*
* @description
* Get the first item of a collection
*
* ```javascript [playground]
* import first from 'https://unpkg.com/rubico/dist/x/first.es.js'
*
* console.log(first([1, 2, 3])) // 1
* console.log(first('abc')) // 'a'
* console.log(first([])) // undefined
* ```
*/
declare function first(value: any): any;