File tree Expand file tree Collapse file tree 5 files changed +22
-6
lines changed
Expand file tree Collapse file tree 5 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,14 @@ function createBoundary(size: number): string {
1010 let res = ""
1111
1212 while ( size -- ) {
13- res += alphabet [ Math . floor ( Math . random ( ) * alphabet . length ) ]
13+ // I use bitwise `<<` here for slightly more performant string fill.
14+ // It will basically do same thing as `Math.truc()`,
15+ // except it only support signed 32-bit integers.
16+ // Because the result of this operation will always be
17+ // a number in range `0` and `alphabet.length - 1` (inclusive),
18+ // so we don't need `Math.floor()` too.
19+ /* eslint no-bitwise: ["error", {"allow": ["<<"]}] */
20+ res += alphabet [ ( Math . random ( ) * alphabet . length ) << 0 ]
1421 }
1522
1623 return res
Original file line number Diff line number Diff line change 2727 "ci" : " c8 npm test && c8 report --reporter=json" ,
2828 "build:esm" : " ttsc --project tsconfig.esm.json" ,
2929 "build:cjs" : " ttsc --project tsconfig.cjs.json" ,
30- "build" : " npm run build:esm && npm run build:cjs" ,
30+ "build:types" : " ttsc --project tsconfig.d.ts.json" ,
31+ "build" : " npm run build:esm && npm run build:cjs && npm run build:types" ,
3132 "test" : " ava --fail-fast" ,
3233 "cleanup" : " npx rimraf @type \" lib/**/*.js\" " ,
3334 "prepare" : " npm run cleanup && npm run build" ,
Original file line number Diff line number Diff line change 1+ {
2+ "extends" : " ./tsconfig.esm.json" ,
3+ "compilerOptions" : {
4+ "declaration" : true ,
5+ "declarationDir" : " ./@type" ,
6+ "removeComments" : false ,
7+ "emitDeclarationOnly" : true
8+ }
9+ }
Original file line number Diff line number Diff line change 22 "extends" : " ./tsconfig.json" ,
33 "compilerOptions" : {
44 "module" : " es2020" ,
5- "outDir" : " lib/esm" ,
6- "declaration" : true ,
7- "declarationDir" : " ./@type" ,
5+ "outDir" : " lib/esm"
86 }
97}
Original file line number Diff line number Diff line change 2121 "forceConsistentCasingInFileNames" : true ,
2222 "allowSyntheticDefaultImports" : true ,
2323 "experimentalDecorators" : true ,
24+ "removeComments" : true ,
2425 "plugins" : [
2526 {
2627 "transform" : " @zoltu/typescript-transformer-append-js-extension/output/index.js" ,
2728 "after" : true
2829 }
2930 ]
3031 }
31- }
32+ }
You can’t perform that action at this time.
0 commit comments