Skip to content

Commit 7278485

Browse files
committed
code linted
1 parent bd1e0b0 commit 7278485

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

index.js

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
const type = require('easytype');
22
const hardProp = require('hard-prop');
3-
const noop = () => {};
3+
const noop = () => undefined;
44
const safeSet = (v = noop) => {
55
if(type.isFunction(v)) return v;
66
throw new TypeError('Function expected');
77
};
88

9-
module.exports = (worker, concurrency = 1) => { // function worker(job, done)
10-
if(concurrency === 0) throw new RangeError('Concurrency can not be 0');
11-
if(!type.isNumber(concurrency)) throw new TypeError('Concurrency must be a number');
9+
module.exports = (worker, _concurrency = 1) => { // function worker(job, done)
10+
if(_concurrency === 0) throw new RangeError('Concurrency can not be 0');
11+
if(!type.isNumber(_concurrency)) throw new TypeError('Concurrency must be a number');
1212
if(!type.isFunction(worker)) throw new TypeError('Worker must be a function');
1313

14-
let delay = concurrency < 0 ? -concurrency : 0;
15-
concurrency = concurrency > 0 ? concurrency : 1;
14+
let delay = _concurrency < 0 ? -_concurrency : 0;
15+
let concurrency = _concurrency > 0 ? _concurrency : 1;
1616
let buffer = concurrency / 4;
1717
let paused = false;
1818
let started = false;
@@ -127,12 +127,11 @@ module.exports = (worker, concurrency = 1) => { // function worker(job, done)
127127
};
128128
if(!paused) startJob();
129129
};
130-
const status = job =>
131-
queue.waiting.map(v => v.data).includes(job) ? 'waiting' :
132-
queue.active.map(v => v.data).includes(job) ? 'active' :
133-
queue.finished.map(v => v.data).includes(job) ? 'finished' :
134-
queue.failed.map(v => v.data).includes(job) ? 'failed' :
135-
'missing';
130+
const status = job => queue.waiting.map(v => v.data).includes(job) ? 'waiting' :
131+
queue.active.map(v => v.data).includes(job) ? 'active' :
132+
queue.finished.map(v => v.data).includes(job) ? 'finished' :
133+
queue.failed.map(v => v.data).includes(job) ? 'failed' :
134+
'missing';
136135

137136
// queue object:
138137
const tress = {};

0 commit comments

Comments
 (0)