Fix custom random return condition (#248)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Enrico Scherlies · committed by GitHub · parent 838404e · Browse files · 5 files·+10 added−10 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+10 added−10 removed
- other:+10 added−10 removed
Provenance
- Commit
024e112- Tree
93d1d7f- Author
Enrico Scherlies <e.scherlies@me.com>- Committer
GitHub <noreply@github.com>- Parent
838404e
5 files changed+10 added−10 removed
modified:async/index.browser.js+2 added-2 removed
32 unmodified lines33343536373837383940414229 unmodified lines32 unmodified lines let i = step while (i--) { // Adding `|| ''` refuses a random byte that exceeds the alphabet size. id += alphabet[bytes[i] & mask] || '' // `id.length + 1 === size` is a more compact option. if (id.length === +size) return Promise.resolve(id) // Return if id length equals size. if (id.length === size) return Promise.resolve(id) } } }}29 unmodified linesmodified:async/index.js+2 added-2 removed
43 unmodified lines44454647484948495051525319 unmodified lines43 unmodified lines let i = step while (i--) { // Adding `|| ''` refuses a random byte that exceeds the alphabet size. id += alphabet[bytes[i] & mask] || '' // `id.length + 1 === size` is a more compact option. if (id.length === +size) return id // Return if id length equals size. if (id.length === size) return id } return tick(id) })
19 unmodified linesmodified:async/index.native.js+2 added-2 removed
29 unmodified lines30 let i = step31 while (i--) {32 // Adding `|| ''` refuses a random byte that exceeds the alphabet size.33 id += alphabet[bytes[i] & mask] || ''34- // `id.length + 1 === size` is a more compact option.35- if (id.length === +size) return id34+ // Return if id length equals size.35+ if (id.length === size) return id36 }37 return tick(id)38 })39 19 unmodified linesmodified:index.browser.js+2 added-2 removed
65 unmodified lines66 let j = step67 while (j--) {68 // Adding `|| ''` refuses a random byte that exceeds the alphabet size.69 id += alphabet[bytes[j] & mask] || ''70- // `id.length + 1 === size` is a more compact option.71- if (id.length === +size) return id70+ // Return if id length equals size.71+ if (id.length === size) return id72 }73 }74 }75 }31 unmodified linesmodified:index.js+2 added-2 removed
52 unmodified lines53 let i = step54 while (i--) {55 // Adding `|| ''` refuses a random byte that exceeds the alphabet size.56 id += alphabet[bytes[i] & mask] || ''57- // `id.length + 1 === size` is a more compact option.58- if (id.length === +size) return id57+ // Return if id length equals size.58+ if (id.length === size) return id59 }60 }61 }62 }19 unmodified lines