Comparing version 1.1.20 to 1.1.21
@@ -10,3 +10,3 @@ module.exports = last; | ||
function last(arr) { | ||
return arr[arr.length - 1]; | ||
return arr != null ? arr[arr.length - 1] : undefined; | ||
} |
{ | ||
"name": "just-last", | ||
"version": "1.1.20", | ||
"version": "1.1.21", | ||
"description": "return the last member of an array", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,2 +12,6 @@ ## just-last | ||
last([true, false, [true, false]]); // [true, false] | ||
last(); // undefined | ||
last([]); // undefined | ||
last(null); // undefined | ||
last(undefined); // undefined | ||
``` |
1105
17