Skip to content

Commit

Permalink
chore: Standardize module setup
Browse files Browse the repository at this point in the history
  • Loading branch information
iarna committed Jun 3, 2019
1 parent b14d69a commit 159abb2
Show file tree
Hide file tree
Showing 5 changed files with 4,581 additions and 2,196 deletions.
7 changes: 7 additions & 0 deletions PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--
⚠️🚨 BEFORE FILING A PR: 🚨⚠️

👉🏼 CONTRIBUTING.md 👈🏼 (the "contribution guidelines" up there ☝🏼)

I PROMISE IT'S A VERY VERY SHORT READ.🙇🏼
-->
8 changes: 4 additions & 4 deletions call-limit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use strict"
'use strict'

const defaultMaxRunning = 50

Expand All @@ -14,12 +14,12 @@ const limit = module.exports = function (func, maxRunning) {
}
}
function callNext () {
if (!state.queue.length) return
if (state.queue.length === 0) return
const next = state.queue.shift()
callFunc(next.obj, next.args)
}
function callFunc (obj, args) {
const cb = typeof args[args.length-1] === 'function' && args.pop()
const cb = typeof args[args.length - 1] === 'function' && args.pop()
try {
++state.running
func.apply(obj, args.concat(function () {
Expand Down Expand Up @@ -59,7 +59,7 @@ module.exports.promise = function (func, maxRunning) {
}
}
function callNext () {
if (!state.queue.length) return
if (state.queue.length === 0) return
const next = state.queue.shift()
next.resolve(callFunc(next.obj, next.args))
}
Expand Down
Loading

0 comments on commit 159abb2

Please sign in to comment.