source: frontend/node_modules/underscore/modules/last.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 372 bytes
Line 
1import rest from './rest.js';
2
3// Get the last element of an array. Passing **n** will return the last N
4// values in the array.
5export default function last(array, n, guard) {
6 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
7 if (n == null || guard) return array[array.length - 1];
8 return rest(array, Math.max(0, array.length - n));
9}
Note: See TracBrowser for help on using the repository browser.