Skip to content

Commit 3b13420

Browse files
Merge pull request #17 from BlackB1RD-Development/RealBlackB1RD/issue16
1.5.0
2 parents 5fac66f + 8924062 commit 3b13420

14 files changed

+18795
-5348
lines changed

.eslintrc.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,41 @@
1212
"unicorn"
1313
],
1414
"rules": {
15+
"unicorn/import-style": [
16+
"error",
17+
{
18+
"styles": {
19+
"util": false
20+
}
21+
}
22+
],
23+
"unicorn/no-static-only-class": "off",
24+
"unicorn/no-array-for-each": "off",
25+
"unicorn/no-nested-ternary": "off",
26+
"unicorn/prefer-switch": "off",
1527
"unicorn/filename-case": "off",
28+
"unicorn/prefer-module": "off",
29+
"no-async-promise-executor": "off",
30+
"no-prototype-builtins": "off",
1631
"object-curly-spacing": ["error", "always"],
32+
"no-negated-condition": "off",
33+
"no-array-constructor": "off",
34+
"no-implicit-coercion": "off",
35+
"no-unneeded-ternary": "off",
36+
"no-mixed-operators": "off",
37+
"arrow-body-style": "off",
38+
"no-return-assign": "off",
39+
"no-else-return": "off",
40+
"no-new-object": "off",
41+
"comma-dangle": ["error", "never"],
1742
"no-console": "off",
43+
"complexity": "off",
1844
"camelcase": ["error", {"properties": "never"}],
45+
"one-var": "off",
1946
"no-var": "error",
2047
"indent": ["error", 2],
2148
"quotes": ["error", "single"],
49+
"curly": "off",
2250
"semi": ["error", "always"]
2351
}
2452
}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
* [[`v1.2`](https://github.com/BlackB1RD-Development/tools-kit/tree/v1.2)] - [version] 1.2
66
* [[`v1.3`](https://github.com/BlackB1RD-Development/tools-kit/tree/v1.3)] - [version] 1.3
77
* [[`v1.4`](https://github.com/BlackB1RD-Development/tools-kit/tree/v1.4)] - [version] 1.4
8+
* [[`v1.5`](https://github.com/BlackB1RD-Development/tools-kit/tree/v1.5)] - [version] 1.5

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
<a href="https://www.npmjs.com/package/tools-kit">
1717
<img src="https://img.shields.io/node/v/tools-kit.svg?style=flat-square" alt="node" />
1818
</a>
19-
<a href="https://david-dm.org/BlackB1RD-Development/tools-kit">
20-
<img src="https://david-dm.org/BlackB1RD-Development/tools-kit.svg?style=flat-square" alt="dependencies" />
21-
</a>
2219
<a href="https://github.com/BlackB1RD-Development/tools-kit/blob/master/LICENSE.md">
2320
<img src="https://img.shields.io/npm/l/tools-kit.svg?style=flat-square" alt="license" />
2421
</a>
@@ -541,7 +538,7 @@ See the [**Changes Log**][changelog] for more information about each update.
541538
- [**moment**][moment] — A lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.
542539
- [**figlet**][figlet] — Creates ASCII Art from text. A full implementation of the FIGfont spec.
543540

544-
[hastebin]:https://hastebin.com/about.md
541+
[hastebin]:https://toptal.com/developers/hastebin/about.md
545542
[changelog]:https://github.com/BlackB1RD-Development/tools-kit/blob/master/CHANGELOG.md
546543
[contributors]:https://github.com/BlackB1RD-Development/tools-kit/contributors
547544
[documentations]:https://tools-kit.js.org/api

examples/HastebinClient.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@
77
const { logger, hastebin } = require('..');
88

99
hastebin.post('var test = \'test\';\n\nconsole.log(test);', '.js')
10-
.then(async postRes => {
11-
logger.success({ tag: 'POST RES' }, postRes);
10+
.then(async postResponse => {
11+
logger.success({ tag: 'POST RES' }, postResponse);
1212
// Console > [20/02/2020 - 00:00:00 | POST RES]: HastebinObject{}
1313

14-
await hastebin.get(postRes.link)
15-
.then(getRes => {
16-
logger.success({ tag: 'GET RES' }, getRes);
14+
await hastebin.get(postResponse.link)
15+
.then(getResponse => {
16+
logger.success({ tag: 'GET RES' }, getResponse);
1717
// Console > [20/02/2020 - 00:00:00 | GET RES]: HastebinObject{}
1818
})
19-
.catch(getErr => {
20-
logger.error({ tag: 'GET ERROR' }, getErr);
19+
.catch(getError => {
20+
logger.error({ tag: 'GET ERROR' }, getError);
2121
// Console > [20/02/2020 - 00:00:00 | GET ERROR]: Error: Get Error
2222
});
2323
})
24-
.catch(postErr => {
25-
logger.error({ tag: 'POST ERROR' }, postErr);
24+
.catch(postError => {
25+
logger.error({ tag: 'POST ERROR' }, postError);
2626
// Console > [20/02/2020 - 00:00:00 | POST ERROR]: Error: Post Error
2727
});

examples/LoggerManager.js

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,18 @@ logger.figlet('FIGLET', 'LOG');
4747
const scsSettings = {
4848
time: 'H:mm',
4949
tag: 'PUBLISH SUCCESS',
50-
format: (options) => {
51-
return `[${options.tag}]: Published ${options.content} successfully at ${options.time}`;
52-
}
53-
}, errSettings = {
50+
format: options => `[${options.tag}]: Published ${options.content} successfully at ${options.time}`
51+
},
52+
errorSettings = {
5453
time: 'H:mm',
5554
tag: 'PUBLISH ERROR',
56-
format: (options) => {
57-
return `[${options.tag}]: Couldn't publish ${options.content} at ${options.time}`;
58-
}
59-
}, settings = {
55+
format: options => `[${options.tag}]: Couldn't publish ${options.content} at ${options.time}`
56+
},
57+
settings = {
6058
tag: 'PUBLISH API',
61-
format: (options) => {
62-
return `[${options.tag}]: Publish API ${options.content} | Last Check: ${options.time}`;
63-
}
64-
}, figSettings = {
59+
format: options => `[${options.tag}]: Publish API ${options.content} | Last Check: ${options.time}`
60+
},
61+
figSettings = {
6562
figlet: {
6663
font: 'Ghost',
6764
verticalLayout: 'default',
@@ -76,23 +73,23 @@ const scsSettings = {
7673
type: 'log',
7774
time: 'MM/DD/YY',
7875
tag: true,
79-
format: (options) => {
80-
return !options.time && !options.tag ? options.content : !options.time ? `[${options.tag}]: ${options.content}` : !options.tag ? `[${options.time}]: ${options.content}` : `[${options.time} | ${options.tag}]: ${options.content}`;
81-
}
76+
format: options => !options.time && !options.tag ? options.content : !options.time ? `[${options.tag}]: ${options.content}` : !options.tag ? `[${options.time}]: ${options.content}` : `[${options.time} | ${options.tag}]: ${options.content}`
8277
}
8378
}
84-
}, image = {
79+
},
80+
image = {
8581
name: 'logo.png',
8682
size: '5MB'
87-
}, api = {
83+
},
84+
api = {
8885
message: 'Internal Server Error',
8986
code: '500'
9087
};
9188

9289
logger.success(scsSettings, 'image named "%s" with a total size of %s', image.name, image.size);
9390
// Console > [PUBLISH SUCCESS]: Published image named "logo.png" with a total size of 5MB successfully at 20:00
9491

95-
logger.error(errSettings, 'image named "%s" with a total size of %s', image.name, image.size);
92+
logger.error(errorSettings, 'image named "%s" with a total size of %s', image.name, image.size);
9693
// Console > [PUBLISH ERROR]: Couldn't publish image named "logo.png" with a total size of 5MB at 20:00
9794

9895
logger.info(settings, 'respond with %s status code and "%s" message', api.code, api.message);

examples/UtilUtilities.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ logger.log({ tag: 'HAS?' }, util.has(['name', 'test'], 'name'));
3030
logger.log({ tag: 'HAS?' }, util.has(['test', 'not test'], 'name'));
3131
// Console > [20/02/2020 - 00:00:00 | HAS?]: false
3232

33-
logger.log({ tag: 'HAS?' }, util.has([{ 'name': 'not test' }, { 'name': 'test' }], 'name'));
33+
logger.log({ tag: 'HAS?' }, util.has([{ name: 'not test' }, { name: 'test' }], 'name'));
3434
// Console > [20/02/2020 - 00:00:00 | HAS?]: true
3535

36-
logger.log({ tag: 'HAS?' }, util.has([{ 'name': 'not test' }, { 'name': 'test' }], 'test', 'name'));
36+
logger.log({ tag: 'HAS?' }, util.has([{ name: 'not test' }, { name: 'test' }], 'test', 'name'));
3737
// Console > [20/02/2020 - 00:00:00 | HAS?]: false
3838

39-
logger.log({ tag: 'HAS?' }, util.has([{ 'name': 'not test' }, { 'name': 'test' }], 'name', 'test'));
39+
logger.log({ tag: 'HAS?' }, util.has([{ name: 'not test' }, { name: 'test' }], 'name', 'test'));
4040
// Console > [20/02/2020 - 00:00:00 | HAS?]: true
4141

4242
logger.log({ tag: 'ARRAY?' }, util.isArray(new Array()));

lib/Clients/Hastebin.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,26 @@ class Hastebin {
3535
}
3636
};
3737

38-
return new Promise(async(resolve, reject) => {
38+
return new Promise(async (resolve, reject) => {
3939
await fetch(request.url, request.options)
40-
.then(async res => {
41-
if (!res.ok) return reject(new Error(res.statusText));
40+
.then(async response => {
41+
if (!response.ok) return reject(new Error(response.statusText));
4242

43-
const { key } = await res.json();
43+
const { key } = await response.json();
4444

45-
const HastebinObj = {
45+
const HastebinObject = {
4646
link: link.host + '/' + key + link.extension,
4747
host: link.host,
4848
key,
4949
extension: link.extension,
5050
content: data,
51-
ratelimit: res.headers.get('x-ratelimit-limit'),
52-
ratelimit_remaining: res.headers.get('x-ratelimit-remaining'),
53-
status_txt: res.statusText,
54-
status_code: res.status
51+
ratelimit: response.headers.get('x-ratelimit-limit'),
52+
ratelimit_remaining: response.headers.get('x-ratelimit-remaining'),
53+
status_txt: response.statusText,
54+
status_code: response.status
5555
};
5656

57-
return resolve(HastebinObj);
57+
return resolve(HastebinObject);
5858
})
5959
.catch(error => reject(new Error(error)));
6060
});
@@ -72,7 +72,7 @@ class Hastebin {
7272
const link = {
7373
extension: url.replace(hastebinURLS.regex, '').includes('.') ? `.${url.replace(hastebinURLS.regex, '').split('.').pop()}` : '',
7474
host: hastebinURLS.httpsWWW,
75-
key: url.replace(hastebinURLS.regex, '').includes('.') ? url.replace(hastebinURLS.regex, '').split('.').shift() : url.replace(/https?:\/\//, '').split('/').pop()
75+
key: url.replace(hastebinURLS.regex, '').includes('.') ? url.replace(hastebinURLS.regex, '').split('/').pop().split('.').shift() : url.replace(/https?:\/\//, '').split('/').pop()
7676
};
7777
const request = {
7878
url: hastebinURLS.documentsHttpsWWW + '/' + link.key + link.extension,
@@ -84,26 +84,26 @@ class Hastebin {
8484
}
8585
};
8686

87-
return new Promise(async(resolve, reject) => {
87+
return new Promise(async (resolve, reject) => {
8888
await fetch(request.url, request.options)
89-
.then(async res => {
90-
if (!res.ok) return reject(new Error(res.statusText));
89+
.then(async response => {
90+
if (!response.ok) return reject(new Error(response.statusText));
9191

92-
const { key, data } = await res.json();
92+
const { key, data } = await response.json();
9393

94-
const HastebinObj = {
94+
const HastebinObject = {
9595
link: link.host + '/' + key + link.extension,
9696
host: link.host,
9797
key,
9898
extension: link.extension,
9999
content: data,
100-
ratelimit: res.headers.get('x-ratelimit-limit'),
101-
ratelimit_remaining: res.headers.get('x-ratelimit-remaining'),
102-
status_txt: res.statusText,
103-
status_code: res.status
100+
ratelimit: response.headers.get('x-ratelimit-limit'),
101+
ratelimit_remaining: response.headers.get('x-ratelimit-remaining'),
102+
status_txt: response.statusText,
103+
status_code: response.status
104104
};
105105

106-
return resolve(HastebinObj);
106+
return resolve(HastebinObject);
107107
})
108108
.catch(error => reject(new Error(error)));
109109
});

0 commit comments

Comments
 (0)