UNPKG

1-liners

Version:

Useful oneliners and shorthand functions

16 lines (15 loc) 240 B
/** * @module 1-liners/last * * @description * * Returns the last item of `array`. * * @example * * const last = require('1-liners/last'); * * last([1, 2, 3]); // => 3 * */ export default (array) => array[array.length - 1];