Comparing version 1.1.0 to 1.1.1
10
index.js
module.exports = toBuffer | ||
var makeBuffer = Buffer.from && Buffer.from !== Uint8Array.from ? Buffer.from : bufferFrom | ||
function bufferFrom (buf, enc) { | ||
return new Buffer(buf, enc) | ||
} | ||
function toBuffer (buf, enc) { | ||
if (Buffer.isBuffer(buf)) return buf | ||
if (typeof buf === 'string') return new Buffer(buf, enc) | ||
if (Array.isArray(buf)) return new Buffer(buf) | ||
if (typeof buf === 'string') return makeBuffer(buf, enc) | ||
if (Array.isArray(buf)) return makeBuffer(buf) | ||
throw new Error('Input should be a buffer or a string') | ||
} |
{ | ||
"name": "to-buffer", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"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", |
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
3254
33
6