Skip to content

Commit d530186

Browse files
committed
variable definition modified
variable names got changed for a better understanding of their usage
1 parent ff0955f commit d530186

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

index.cjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
'use strict';
22
function randomItemWithNoRepetition(array) {
33
if (!Array.isArray(array) || array.length === 0) return -1;
4-
var copy = array.slice();
4+
var copyOfArray = array.slice();
55
return function () {
6-
copy.length < 1 && (copy = array.slice());
7-
var index = Math.floor(Math.random() * copy.length),
8-
item = copy[index];
9-
return copy.splice(index, 1), item;
6+
copyOfArray.length < 1 && (copyOfArray = array.slice());
7+
var index = Math.floor(Math.random() * copyOfArray.length),
8+
item = copyOfArray[index];
9+
return copyOfArray.splice(index, 1), item;
1010
};
1111
}
1212

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@smakss/random-array-element",
3-
"version": "1.1.4",
3+
"version": "1.1.5",
44
"description": "Selects a random unique array element without repetition from provided array.",
55
"type": "module",
66
"main": "./index.cjs",

0 commit comments

Comments
 (0)