You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 3.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # array-last [![NPM version](https://img.shields.io/npm/v/array-last.svg?style=flat)](https://www.npmjs.com/package/array-last) [![NPM monthly downloads](https://img.shields.io/npm/dm/array-last.svg?style=flat)](https://npmjs.org/package/array-last) [![NPM total downloads](https://img.shields.io/npm/dt/array-last.svg?style=flat)](https://npmjs.org/package/array-last) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/array-last.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/array-last)
  2. > Get the last or last n elements in an array.
  3. Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
  4. ## Install
  5. Install with [npm](https://www.npmjs.com/):
  6. ```sh
  7. $ npm install --save array-last
  8. ```
  9. ## Usage
  10. ```js
  11. var last = require('array-last');
  12. last(['a', 'b', 'c', 'd', 'e', 'f']);
  13. //=> 'f'
  14. last(['a', 'b', 'c', 'd', 'e', 'f'], 1);
  15. //=> 'f'
  16. last(['a', 'b', 'c', 'd', 'e', 'f'], 3);
  17. //=> ['d', 'e', 'f']
  18. ```
  19. ## About
  20. <details>
  21. <summary><strong>Contributing</strong></summary>
  22. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
  23. </details>
  24. <details>
  25. <summary><strong>Running Tests</strong></summary>
  26. Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
  27. ```sh
  28. $ npm install && npm test
  29. ```
  30. </details>
  31. <details>
  32. <summary><strong>Building docs</strong></summary>
  33. _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
  34. To generate the readme, run the following command:
  35. ```sh
  36. $ npm install -g verbose/verb#dev verb-generate-readme && verb
  37. ```
  38. </details>
  39. ### Related projects
  40. You might also be interested in these projects:
  41. * [arr-union](https://www.npmjs.com/package/arr-union): Combines a list of arrays, returning a single array with unique values, using strict equality… [more](https://github.com/jonschlinkert/arr-union) | [homepage](https://github.com/jonschlinkert/arr-union)
  42. * [array-unique](https://www.npmjs.com/package/array-unique): Remove duplicate values from an array. Fastest ES5 implementation. | [homepage](https://github.com/jonschlinkert/array-unique)
  43. * [array-xor](https://www.npmjs.com/package/array-xor): Returns the symmetric difference (exclusive-or) of an array of elements (elements that are present in… [more](https://github.com/jonschlinkert/array-xor) | [homepage](https://github.com/jonschlinkert/array-xor)
  44. ### Contributors
  45. | **Commits** | **Contributor** |
  46. | --- | --- |
  47. | 19 | [jonschlinkert](https://github.com/jonschlinkert) |
  48. | 3 | [SpyMaster356](https://github.com/SpyMaster356) |
  49. | 2 | [bendrucker](https://github.com/bendrucker) |
  50. | 2 | [phated](https://github.com/phated) |
  51. ### Author
  52. **Jon Schlinkert**
  53. * [github/jonschlinkert](https://github.com/jonschlinkert)
  54. * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
  55. ### License
  56. Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
  57. Released under the [MIT License](LICENSE).
  58. ***
  59. _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on November 30, 2017._