x-address-codec
Advanced tools
Comparing version 0.3.2 to 0.4.0
@@ -5,3 +5,2 @@ 'use strict'; | ||
/*eslint-disable no-unused-vars*/ | ||
var ALPHABETS = { | ||
@@ -32,5 +31,15 @@ bitcoin: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz', | ||
function buildCodecsMap(alphabets, Codec) { | ||
var codecs = {}; | ||
for (var _name in ALPHABETS) { | ||
codecs[_name] = new Codec(ALPHABETS[_name]); | ||
}if (alphabets !== ALPHABETS) { | ||
for (var _name2 in alphabets) { | ||
codecs[_name2] = new Codec(alphabets[_name2]); | ||
} | ||
} | ||
return codecs; | ||
} | ||
function apiFactory(options) { | ||
var Codec = codecFactory(options); | ||
var _options$alphabets = options.alphabets; | ||
@@ -41,9 +50,8 @@ var alphabets = _options$alphabets === undefined ? ALPHABETS : _options$alphabets; | ||
var _options$defaultAlphabet = options.defaultAlphabet; | ||
var defaultAlphabet = _options$defaultAlphabet === undefined ? alphabets === ALPHABETS ? 'bitcoin' : Object.keys(alphabets)[0] : _options$defaultAlphabet; | ||
var defaultAlphabet = _options$defaultAlphabet === undefined ? Object.keys(alphabets)[0] : _options$defaultAlphabet; | ||
/*eslint-enable no-unused-vars*/ | ||
var codecs = {}; | ||
for (var _name in alphabets) { | ||
codecs[_name] = new Codec(alphabets[_name]); | ||
}return addMethods(codecMethods, { | ||
var Codec = codecFactory(options); | ||
var codecs = buildCodecsMap(alphabets, Codec); | ||
return addMethods(codecMethods, { | ||
Codec: Codec, | ||
@@ -50,0 +58,0 @@ codecs: codecs, |
{ | ||
"name": "x-address-codec", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"description": "crypto currency address codec", | ||
@@ -5,0 +5,0 @@ "files": [ |
14365
250