just-shuffle
Advanced tools
Comparing version 1.0.0 to 2.0.0
12
index.js
@@ -6,11 +6,11 @@ module.exports = shuffle; | ||
shuffle([1]); // [1] | ||
shuffle(); // undefined | ||
shuffle(undefined); // undefined | ||
shuffle(null); // undefined | ||
shuffle({}); // undefined | ||
shuffle(); // throws | ||
shuffle(undefined); // throws | ||
shuffle(null); // throws | ||
shuffle({}); // throws | ||
*/ | ||
function shuffle(arr) { | ||
if (!arr || !('length' in arr)) { | ||
return undefined; | ||
if (!Array.isArray(arr)) { | ||
throw new Error('expected an array'); | ||
} | ||
@@ -17,0 +17,0 @@ var len = arr.length; |
{ | ||
"name": "just-shuffle", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "return the elements of an array in random order", | ||
@@ -10,9 +10,3 @@ "main": "index.js", | ||
"repository": "https://github.com/angus-c/just", | ||
"keywords": [ | ||
"array", | ||
"random", | ||
"shuffle", | ||
"no-dependencies", | ||
"just" | ||
], | ||
"keywords": ["array", "random", "shuffle", "no-dependencies", "just"], | ||
"author": "Angus Croll", | ||
@@ -19,0 +13,0 @@ "license": "MIT", |
1502