File tree Expand file tree Collapse file tree 5 files changed +12
-3
lines changed
Expand file tree Collapse file tree 5 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 44 "description" : " Cross environment random string generator." ,
55 "main" : " dist/index.js" ,
66 "browser" : " dist/index.web.js" ,
7+ "esnext" : {
8+ "main" : " src/Node/index.js" ,
9+ "browser" : " src/Web/index.js"
10+ },
711 "scripts" : {
812 "test" : " eslint src/ && jest" ,
913 "build:prod" : " cross-env NODE_ENV=production webpack --config webpack.config.js"
1519 " node" ,
1620 " random string"
1721 ],
22+ "jest" : {
23+ "collectCoverage" : true ,
24+ "coverageReporters" : [
25+ " text"
26+ ]
27+ },
1828 "author" : " Johannes Tegnér <johannes@jitesoft.com>" ,
1929 "license" : " MIT" ,
2030 "devDependencies" : {
Original file line number Diff line number Diff line change 1+ /* istanbul ignore next */
12export default class Generator {
23 /**
34 * @internal
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import Generator from './Generator';
22import { randomBytes } from 'crypto' ;
33
44export default class NodeGenerator extends Generator {
5-
65 getRandom ( len ) {
76 return randomBytes ( len ) ;
87 }
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ export const shuffle = (list) => {
44 let temp = null ;
55 let rI = null ;
66
7- while ( 0 !== i ) {
7+ while ( i !== 0 ) {
88 rI = Math . floor ( Math . random ( ) * i ) ;
99 i -- ;
1010 temp = copy [ i ] ;
Original file line number Diff line number Diff line change 11import Generator from './Generator' ;
22
33export default class WebGenerator extends Generator {
4-
54 getRandom ( len ) {
65 const list = new Uint8Array ( len ) ;
76 if ( window . crypto ) {
You can’t perform that action at this time.
0 commit comments