Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

to-buffer

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

to-buffer - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

3

index.js

@@ -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 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc