New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

buffered-kueue

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

buffered-kueue - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

29

lib/buffered-kueue.js

@@ -37,4 +37,4 @@ class BufferedQueueError extends Error {

else throw new BufferedQueueError(`BufferedQueue length exceeds limit(${this.maxSize}).`)
if (!this.started) this.start()
this.didPush(item, this.q)
if (!this.started) this.start()
}

@@ -92,26 +92,53 @@

}
set onFlush (fn) {
this.options.onFlush = fn
}
get willPush () {
return this.options.willPush
}
set willPush (fn) {
this.options.willPush = fn
}
get didPush () {
return this.options.didPush
}
set didPush (fn) {
this.options.didPush = fn
}
get willFlush () {
return this.options.willFlush
}
set willFlush (fn) {
this.options.willFlush = fn
}
get didFlush () {
return this.options.didFlush
}
set didFlush (fn) {
this.options.didFlush = fn
}
get willStart () {
return this.options.willStart
}
set willStart (fn) {
this.options.willStart = fn
}
get didStart () {
return this.options.didStart
}
set didStart (fn) {
this.options.didStart = fn
}
get willStop () {
return this.options.willStop
}
set willStop (fn) {
this.options.willStop = fn
}
get didStop () {
return this.options.didStop
}
set didStop (fn) {
this.options.didStop = fn
}
}

@@ -118,0 +145,0 @@

2

package.json
{
"name": "buffered-kueue",
"version": "1.1.0",
"version": "1.2.0",
"description": "Help you to buffer your tasks",

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

@@ -40,4 +40,4 @@ const Queue = require('../../index')

let result = null
const queue = new Queue({onFlush: (items) => { result = items }, flushInterval: 1000, maxSize: 1})
it('Should flush every 1000 ms', () => {
const queue = new Queue({onFlush: (items) => { result = items }, flushInterval: 1000, maxSize: 1, flushSize: 1})
it('Should throws when max size setted to 1', () => {
return sleep(1000)

@@ -53,2 +53,15 @@ .then(() => expect(result).toBe(null))

})
it('Should runs well after setting didPush lifecycle event', () => {
queue.didPush = (item, q) => {
if (q.length >= queue.flushSize) queue.flush()
}
return sleep(1000)
.then(() => {
queue.push(1)
queue.push(2)
queue.push(3)
return sleep(1000)
})
.then(() => expect(result).toEqual([3]))
})
})

@@ -55,0 +68,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