Socket
Socket
Sign inDemoInstall

fast-fifo

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-fifo - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

6

index.js

@@ -40,8 +40,10 @@ const FixedFIFO = require('./fixed-size')

peek () {
return this.tail.peek()
const val = this.tail.peek()
if (val === undefined && this.tail.next) return this.tail.next.peek()
return val
}
isEmpty () {
return this.head.isEmpty()
return this.length === 0
}
}
{
"name": "fast-fifo",
"version": "1.3.0",
"version": "1.3.1",
"description": "A fast fifo implementation similar to the one powering nextTick in Node.js core",

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

@@ -120,4 +120,21 @@ const test = require('brittle')

test('peek edgecase', function (t) {
const q = new FIFO(4)
q.push('a')
q.push('b')
q.push('c')
q.push('d')
q.push('e')
t.is(q.peek(), q.shift())
t.is(q.peek(), q.shift())
t.is(q.peek(), q.shift())
t.is(q.peek(), q.shift())
t.is(q.peek(), q.shift())
t.is(q.peek(), q.shift())
})
test('invalid hwm', function (t) {
t.exception(() => new FIFO(3))
})
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