node_modules

This commit is contained in:
softprops
2019-10-20 19:16:50 -04:00
parent 0e414c630a
commit 78c309ef59
555 changed files with 103819 additions and 1 deletions

28
node_modules/bottleneck/src/Queues.coffee generated vendored Normal file
View File

@@ -0,0 +1,28 @@
DLList = require "./DLList"
Events = require "./Events"
class Queues
constructor: (num_priorities) ->
@Events = new Events @
@_length = 0
@_lists = for i in [1..num_priorities] then new DLList (=> @incr()), (=> @decr())
incr: -> if @_length++ == 0 then @Events.trigger "leftzero"
decr: -> if --@_length == 0 then @Events.trigger "zero"
push: (job) -> @_lists[job.options.priority].push job
queued: (priority) -> if priority? then @_lists[priority].length else @_length
shiftAll: (fn) -> @_lists.forEach (list) -> list.forEachShift fn
getFirst: (arr=@_lists) ->
for list in arr
return list if list.length > 0
[]
shiftLastFrom: (priority) -> @getFirst(@_lists[priority..].reverse()).shift()
module.exports = Queues