Lint using semistandard

This commit is contained in:
2017-07-09 19:41:48 +01:00
parent 96b27b9505
commit 51d70572b1
4 changed files with 7 additions and 10 deletions

View File

@@ -7,19 +7,19 @@ var alphabetLookup = alphabet.split('').reduce(function (lookup, char, index) {
return lookup;
}, {});
function assertNonNegativeSafeInteger(val) {
function assertNonNegativeSafeInteger (val) {
if (typeof val !== 'number' || isNaN(val) || val < 0 || val > Number.MAX_SAFE_INTEGER || Math.floor(val) !== val) {
throw new Error('Value passed is not a non-negative safe integer.');
}
}
function assertString(str) {
function assertString (str) {
if (typeof str !== 'string') {
throw new Error('Value passed is not a string.');
}
}
function assertBase58Character(character) {
function assertBase58Character (character) {
if (alphabetLookup[character] === undefined) {
throw new Error('Value passed is not a valid Base58 string.');
}