Navigation Menu

Skip to content

Commit

Permalink
Do no import index.js in async/index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed May 16, 2020
1 parent f5565d8 commit f6cad02
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion async/index.js
@@ -1,4 +1,4 @@
let { urlAlphabet } = require('..')
let { urlAlphabet } = require('../url-alphabet')
let { random } = require('./random')

let customAlphabet = (alphabet, size) => {
Expand Down
7 changes: 2 additions & 5 deletions index.browser.js
@@ -1,6 +1,8 @@
// This file replaces `index.js` in bundlers like webpack or Rollup,
// according to `browser` config in `package.json`.

let { urlAlphabet } = require('./url-alphabet')

if (process.env.NODE_ENV !== 'production') {
// All bundlers will remove this block in the production bundle.
if (
Expand Down Expand Up @@ -28,11 +30,6 @@ if (process.env.NODE_ENV !== 'production') {
}
}

// This alphabet uses `A-Za-z0-9_-` symbols. The genetic algorithm helped
// optimize the gzip compression for this alphabet.
let urlAlphabet =
'ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW'

let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))

let customRandom = (alphabet, size, getRandom) => {
Expand Down
3 changes: 1 addition & 2 deletions index.js
@@ -1,7 +1,6 @@
let crypto = require('crypto')

let urlAlphabet =
'_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
let { urlAlphabet } = require('./url-alphabet')

// We reuse buffers with the same size to avoid memory fragmentations
// for better performance.
Expand Down
6 changes: 6 additions & 0 deletions url-alphabet/index.js
@@ -0,0 +1,6 @@
// This alphabet uses `A-Za-z0-9_-` symbols. The genetic algorithm helped
// optimize the gzip compression for this alphabet.
let urlAlphabet =
'ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW'

module.exports = { urlAlphabet }

0 comments on commit f6cad02

Please sign in to comment.