Comparing version 0.0.3 to 0.0.4
@@ -67,2 +67,6 @@ /*! | ||
from(options, extra) { | ||
return this.fromOptions(options, extra); | ||
} | ||
format() { | ||
@@ -97,3 +101,10 @@ return this.getJSON(); | ||
assert(typeof str === 'string'); | ||
return this.decode(Buffer.from(str, 'hex')); | ||
const size = str.length >>> 1; | ||
const data = Buffer.from(str, 'hex'); | ||
if (data.length !== size) | ||
throw new Error('Invalid hex string.'); | ||
return this.decode(data, extra); | ||
} | ||
@@ -107,3 +118,10 @@ | ||
assert(typeof str === 'string'); | ||
return this.decode(Buffer.from(str, 'base64')); | ||
const min = (((str.length - 3) & ~3) * 3) / 4 | 0; | ||
const data = Buffer.from(str, 'base64'); | ||
if (data.length < min) | ||
throw new Error('Invalid base64 string.'); | ||
return this.decode(data, extra); | ||
} | ||
@@ -151,2 +169,6 @@ | ||
static from(options, extra) { | ||
return new this().from(options, extra); | ||
} | ||
/* | ||
@@ -153,0 +175,0 @@ * Aliases |
{ | ||
"name": "bufio", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Buffer and serialization utilities for javascript", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74741
3152