JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2582
  • Score
    100M100P100Q112554F
  • License MIT

return the last member of an array

Package Exports

  • just-last
  • just-last/package.json

Readme

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