Comparing version 1.0.1 to 1.1.0
@@ -5,4 +5,5 @@ module.exports = toBuffer | ||
if (Buffer.isBuffer(buf)) return buf | ||
if (typeof buf === 'string') return Buffer(buf, enc) | ||
if (typeof buf === 'string') return new Buffer(buf, enc) | ||
if (Array.isArray(buf)) return new Buffer(buf) | ||
throw new Error('Input should be a buffer or a string') | ||
} |
{ | ||
"name": "to-buffer", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Pass in a string, get a buffer back. Pass in a buffer, get the same buffer back", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -17,3 +17,3 @@ # to-buffer | ||
console.log(toBuffer(Buffer('hi'))) // <Buffer 68 69> | ||
console.log(toBuffer('6868', 'hex')) // <Buffer 68 69> | ||
console.log(toBuffer('6869', 'hex')) // <Buffer 68 69> | ||
console.log(toBuffer(43)) // throws | ||
@@ -20,0 +20,0 @@ ``` |
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
3109
29