Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/cjs/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
Object.defineProperty(exports, '__esModule', { value: true })
function base (ALPHABET) {
if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
const BASE_MAP = new Uint8Array(256)
for (let j = 0; j < BASE_MAP.length; j++) {
BASE_MAP[j] = 255
}
const BASE_MAP = new Uint8Array(256).fill(255)
for (let i = 0; i < ALPHABET.length; i++) {
const x = ALPHABET.charAt(i)
const xc = x.charCodeAt(0)
Expand Down
5 changes: 1 addition & 4 deletions src/esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
function base (ALPHABET) {
if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
const BASE_MAP = new Uint8Array(256)
for (let j = 0; j < BASE_MAP.length; j++) {
BASE_MAP[j] = 255
}
const BASE_MAP = new Uint8Array(256).fill(255)
for (let i = 0; i < ALPHABET.length; i++) {
const x = ALPHABET.charAt(i)
const xc = x.charCodeAt(0)
Expand Down
5 changes: 1 addition & 4 deletions ts_src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
function base (ALPHABET: string): base.BaseConverter {
if (ALPHABET.length >= 255) throw new TypeError('Alphabet too long')

const BASE_MAP = new Uint8Array(256)
for (let j = 0; j < BASE_MAP.length; j++) {
BASE_MAP[j] = 255
}
const BASE_MAP = new Uint8Array(256).fill(255)

for (let i = 0; i < ALPHABET.length; i++) {
const x = ALPHABET.charAt(i)
Expand Down