making base-x compatible with node & browser

This commit is contained in:
El RIDO 2019-05-08 19:00:22 +02:00
parent b12a099e29
commit 54d21a7803
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
4 changed files with 9 additions and 5 deletions

View file

@ -6,7 +6,9 @@
// Distributed under the MIT software license, see the accompanying
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
var baseX = function base (ALPHABET) {
(function(){
'use strict';
this.baseX = function base (ALPHABET) {
if (ALPHABET.length >= 255) throw new TypeError('Alphabet too long')
const BASE_MAP = new Uint8Array(256)
@ -146,3 +148,4 @@ var baseX = function base (ALPHABET) {
decode: decode
}
}
}).call(this);