File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 1- 'use strict'
1+ 'use strict' ;
22function randomItemWithNoRepetition ( array ) {
3- if ( ! Array . isArray ( array ) || array . length === 0 ) return - 1
4- var copy = array . slice ( )
3+ if ( ! Array . isArray ( array ) || array . length === 0 ) return - 1 ;
4+ var copy = array . slice ( ) ;
55 return function ( ) {
6- copy . length < 1 && ( copy = array . slice ( ) )
6+ copy . length < 1 && ( copy = array . slice ( ) ) ;
77 var index = Math . floor ( Math . random ( ) * copy . length ) ,
8- item = copy [ index ]
9- return copy . splice ( index , 1 ) , item
8+ item = copy [ index ] ;
9+ return copy . splice ( index , 1 ) , item ;
1010 }
1111}
1212
13- module . exports = randomItemWithNoRepetition
13+ module . exports = randomItemWithNoRepetition ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @smakss/random-array-element" ,
3- "version" : " 1.0.7 " ,
3+ "version" : " 1.0.8 " ,
44 "description" : " Selects a random array element without repetition." ,
55 "type" : " module" ,
66 "main" : " ./index.cjs" ,
1313 "url" : " git+https://github.com/SMAKSS/random-array-element.git"
1414 },
1515 "keywords" : [
16- " ES5" ,
17- " ES6" ,
1816 " npm" ,
1917 " yarn" ,
2018 " array" ,
2119 " SMAKSS" ,
2220 " random" ,
21+ " CommonJS" ,
22+ " EcmaScript" ,
2323 " random-index" ,
2424 " random-array-element" ,
2525 " random-element-without-repeat" ,
You can’t perform that action at this time.
0 commit comments