Add production dependencies
This commit is contained in:
parent
5a0114f3e2
commit
579ccdc29f
12113 changed files with 978046 additions and 3 deletions
30
node_modules/array-last/index.js
generated
vendored
Normal file
30
node_modules/array-last/index.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*!
|
||||
* array-last <https://github.com/jonschlinkert/array-last>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
var isNumber = require('is-number');
|
||||
|
||||
module.exports = function last(arr, n) {
|
||||
if (!Array.isArray(arr)) {
|
||||
throw new Error('expected the first argument to be an array');
|
||||
}
|
||||
|
||||
var len = arr.length;
|
||||
if (len === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
n = isNumber(n) ? +n : 1;
|
||||
if (n === 1) {
|
||||
return arr[len - 1];
|
||||
}
|
||||
|
||||
var res = new Array(n);
|
||||
while (n--) {
|
||||
res[n] = arr[--len];
|
||||
}
|
||||
return res;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue