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

it-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

it-buffer - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

14

index.js

@@ -16,1 +16,15 @@ 'use strict'

}
module.exports.toBuffer = module.exports
module.exports.toList = async function * (source) {
for await (const b of source) {
if (Buffer.isBuffer(b)) {
yield new BufferList().append(b)
} else if (BufferList.isBufferList(b)) {
yield b
} else {
yield new BufferList().append(Buffer.from(b))
}
}
}

2

package.json
{
"name": "it-buffer",
"version": "0.1.0",
"version": "0.1.1",
"description": "Is it a string? Is it a BufferList? Or just a Buffer? Worry no more with `it-buffer`!",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -18,1 +18,3 @@ # it-buffer

```
Also exposes `.toBuffer()` (the same as above) and `.toList()` (returns BufferLists instead of Buffers)

@@ -14,3 +14,3 @@ 'use strict'

const res = await pipe(
async function * () {
function * () {
yield input

@@ -26,2 +26,16 @@ },

const t2 = (name, input, output) => {
it(name, async () => {
const res = await pipe(
function * () {
yield input
},
toBuffer.toList,
collect
)
assert.deepEqual(res, [output], 'invalid data returned')
})
}
describe('it-buffer', () => {

@@ -45,2 +59,20 @@ t(

)
t2(
'string',
'hello',
new BufferList().append(Buffer.from('hello'))
)
t2(
'buffer',
Buffer.from('hi'),
new BufferList().append(Buffer.from('hi'))
)
t2(
'buffer-list',
new BufferList().append(Buffer.from('hello')).append(Buffer.from('world')),
new BufferList().append(Buffer.from('hello')).append(Buffer.from('world'))
)
})
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