Skip to content

Commit 67cc0c3

Browse files
committed
Package got updated!
1 parent c0667ee commit 67cc0c3

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ then to use it within your application you can do it just like this:
3030

3131
```
3232
const chooser = randomArrayElement(['Foo', 'Bar', 'FU', 'FooBar']);
33-
33+
// If the input was not array or was empty the chooser will be equal to -1, so chooser() will throw an error.
3434
chooser() // Foo
3535
chooser() // Bar
3636
chooser() // FU

index.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict'
22
function randomItemWithNoRepetition(array) {
3+
if (!Array.isArray(array) || array.length === 0) return -1
34
var copy = array.slice()
45
return function () {
56
copy.length < 1 && (copy = array.slice())

0 commit comments

Comments
 (0)