Skip to content
Myr

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

5 files+10 added−10 removed

modified:async/index.browser.js+2 added-2 removed
modified:async/index.js+2 added-2 removed
modified:async/index.native.js+2 added-2 removed
29 unmodified lines
30 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 lines
modified:index.browser.js+2 added-2 removed
65 unmodified lines
66 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 lines
modified:index.js+2 added-2 removed
52 unmodified lines
53 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