Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit e032d1c

Browse files
committed
clean up diff & update yarn
- whitepace magic to minimize diff - update yarn.lock file
1 parent f6f49da commit e032d1c

File tree

2 files changed

+36
-37
lines changed

2 files changed

+36
-37
lines changed

src/models/base.js

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ const request = require('request-promise-native');
22
const url = require('url');
33
const async = require('async');
44
const crypto = require('crypto');
5-
const throttledQueue = require('throttled-queue');
6-
7-
const throttle = throttledQueue(10, 1000);
5+
const throttle = require('throttled-queue')(10, 1000);
86

97
/**
108
* base model
@@ -38,23 +36,21 @@ class base {
3836

3937
data.private_token = this.token;
4038

41-
return new Promise((resolve, reject) => {
42-
throttle(() => {
43-
request.post(`${this.url}${path}`, {
44-
json: true,
45-
body: data,
46-
insecure: this._insecure,
47-
proxy: this._proxy,
48-
resolveWithFullResponse: true,
49-
headers: {
50-
'PRIVATE-TOKEN': this.token
51-
}
52-
}).then(response => {
53-
if (this.config.get('_createDump')) this.setDump(response, key);
54-
resolve(response);
55-
}).catch(e => reject(e));
56-
})
57-
});
39+
return new Promise((resolve, reject) => throttle(() => {
40+
request.post(`${this.url}${path}`, {
41+
json: true,
42+
body: data,
43+
insecure: this._insecure,
44+
proxy: this._proxy,
45+
resolveWithFullResponse: true,
46+
headers: {
47+
'PRIVATE-TOKEN': this.token
48+
}
49+
}).then(response => {
50+
if (this.config.get('_createDump')) this.setDump(response, key);
51+
resolve(response);
52+
}).catch(e => reject(e));
53+
}));
5854
}
5955

6056
/**
@@ -71,22 +67,20 @@ class base {
7167
path += (path.includes('?') ? '&' : '?') + `private_token=${this.token}`;
7268
path += `&page=${page}&per_page=${perPage}`;
7369

74-
return new Promise((resolve, reject) => {
75-
throttle(() => {
76-
request(`${this.url}${path}`, {
77-
json: true,
78-
insecure: this._insecure,
79-
proxy: this._proxy,
80-
resolveWithFullResponse: true,
81-
headers: {
82-
'PRIVATE-TOKEN': this.token
83-
}
84-
}).then(response => {
85-
if (this.config.get('_createDump')) this.setDump(response, key);
86-
resolve(response);
87-
}).catch(e => reject(e));
88-
})
89-
});
70+
return new Promise((resolve, reject) => throttle(() => {
71+
request(`${this.url}${path}`, {
72+
json: true,
73+
insecure: this._insecure,
74+
proxy: this._proxy,
75+
resolveWithFullResponse: true,
76+
headers: {
77+
'PRIVATE-TOKEN': this.token
78+
}
79+
}).then(response => {
80+
if (this.config.get('_createDump')) this.setDump(response, key);
81+
resolve(response);
82+
}).catch(e => reject(e));
83+
}));
9084
}
9185

9286
/**
@@ -197,4 +191,4 @@ class base {
197191
}
198192
}
199193

200-
module.exports = base;
194+
module.exports = base;

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2429,6 +2429,11 @@ [email protected], text-encoding@^0.6.4:
24292429
version "0.6.4"
24302430
resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.6.4.tgz#e399a982257a276dae428bb92845cb71bdc26d19"
24312431

2432+
throttled-queue@^1.0.7:
2433+
version "1.0.7"
2434+
resolved "https://registry.yarnpkg.com/throttled-queue/-/throttled-queue-1.0.7.tgz#da7ed6702941993044a1c5fd2ac3a58582dd2977"
2435+
integrity sha512-/HT49S7m+NvdyJMoMRzIYlawKjeHn8jEc8TZaGmFi5IBu09hIiU/QoP1zcrB9X2qsVC11PgfRfqd8zEQs7PlEA==
2436+
24322437
throttleit@^1.0.0:
24332438
version "1.0.0"
24342439
resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.0.tgz#9e785836daf46743145a5984b6268d828528ac6c"

0 commit comments

Comments
 (0)