Comparing version 1.1.23 to 2.0.0
@@ -7,6 +7,11 @@ module.exports = last; | ||
last([true, false, [true, false]]); // [true, false] | ||
last({}); // throws | ||
last(); // throws | ||
*/ | ||
function last(arr) { | ||
return arr != null ? arr[arr.length - 1] : undefined; | ||
if (!Array.isArray(arr)) { | ||
throw new Error('expected an array'); | ||
} | ||
return arr[arr.length - 1]; | ||
} |
{ | ||
"name": "just-last", | ||
"version": "1.1.23", | ||
"version": "2.0.0", | ||
"description": "return the last member of an array", | ||
@@ -10,8 +10,3 @@ "main": "index.js", | ||
"repository": "https://github.com/angus-c/just", | ||
"keywords": [ | ||
"array", | ||
"last", | ||
"no-dependencies", | ||
"just" | ||
], | ||
"keywords": ["array", "last", "no-dependencies", "just"], | ||
"author": "Angus Croll", | ||
@@ -18,0 +13,0 @@ "license": "MIT", |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
1229
14
0