just-last
TypeScript icon, indicating that this package has built-in type declarations

3.2.0 • Public • Published

just-last

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

🍦 Try it

npm install just-last
yarn add just-last

Return the last member of an array

import last from 'just-last';

last([1, 2, 3, 4, 5]); // 5
last([{a: 1}, {b: 1}, {c: 1}]); // {c: 1}
last([true, false, [true, false]]); // [true, false]
last(); // undefined
last([]); // undefined
last(null); // undefined
last(undefined); // undefined

Package Sidebar

Install

npm i just-last

Weekly Downloads

84

Version

3.2.0

License

MIT

Unpacked Size

4.62 kB

Total Files

9

Last publish

Collaborators

  • angus-c