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