Skip to content

Commit c9f7d68

Browse files
committed
1.3.0
1 parent 0b32a9b commit c9f7d68

15 files changed

Lines changed: 405 additions & 216 deletions

File tree

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ language: node_js
22
node_js:
33
- 7.6
44
- 8
5-
- 10
5+
- 10
6+
after_success: nyc report --reporter=text-lcov | node_modules/.bin/coveralls

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Tools-Kit Change log
2+
23
* [[`v1.0`](https://github.com/BlackB1RD-Development/tools-kit/tree/v1.0)] - [version] 1.0
34
* [[`v1.1`](https://github.com/BlackB1RD-Development/tools-kit/tree/v1.1)] - [version] 1.1
45
* [[`v1.2`](https://github.com/BlackB1RD-Development/tools-kit/tree/v1.2)] - [version] 1.2
6+
* [[`v1.3`](https://github.com/BlackB1RD-Development/tools-kit/tree/v1.3)] - [version] 1.3

README.md

Lines changed: 84 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
<a href="https://travis-ci.org/BlackB1RD-Development/tools-kit">
3232
<img src="https://travis-ci.org/BlackB1RD-Development/tools-kit.svg?branch=master" alt="Build" />
3333
</a>
34+
<a href="https://app.fossa.com/projects/git%2Bgithub.com%2FBlackB1RD-Development%2Ftools-kit?ref=badge_shield" alt="FOSSA Status">
35+
<img src="https://app.fossa.com/api/projects/git%2Bgithub.com%2FBlackB1RD-Development%2Ftools-kit.svg?type=shield"/>
36+
</a>
3437
<a href="https://github.com/BlackB1RD-Development/tools-kit">
3538
<img src="https://img.shields.io/badge/code_style-XO-5ed9c7.svg" alt="Code Style" />
3639
</a>
@@ -42,7 +45,7 @@
4245
<sub>© <a href="https://www.npmjs.com/package/tools-kit">Tools-Kit</a> By <a href="https://github.com/BlackB1RD-Development">BlackB1RD-Development</a> (<b><a href="https://github.com/RealBlackB1RD">@RealBlackB1RD</a></b>). All rights reserved ©</sub>
4346
</p>
4447

45-
## Features
48+
# Features
4649

4750
- A [**Hastebin**][hastebin] Client that can publish your beautiful code online or fetching an existing one.
4851
- A Logger Manager that can style your logs with all the known Node.js console methods.
@@ -51,24 +54,24 @@
5154
- Extremely configurable and debuggable.
5255
- Well documented.
5356

54-
## Installation
57+
# Installation
5558

5659
```console
5760
npm install tools-kit
5861
```
5962

60-
## Class Examples
63+
# Class Examples
6164

6265
Click to jump between class examples:
6366

64-
| Class Name | Class Description |
65-
| --------------- | ------------------------------------------------------------------------------ |
66-
| [Hastebin Client](#tools-kit-hastebin-client) | Post and fetch code easily from [**Hastebin**][hastebin] |
67-
| [Logger](#tools-kit-logger-manager) | Log a styled and colored text into the console |
68-
| [Color](#tools-kit-color-manager) | Transfer your simple text into a styled and modern one (Console support only) |
69-
| [Util](#tools-kit-utilities) | A collection of functions that everyone use in one simple line |
67+
| Class Name | Class Description |
68+
| --------------- | ------------------------------------------------------------------------------ |
69+
|[**Hastebin Client**](#tools-kit-hastebin-client)| Post and fetch code easily from [**Hastebin**][hastebin] |
70+
| [**Logger**](#tools-kit-logger-manager) | Log a styled and colored text into the console |
71+
| [**Color**](#tools-kit-color-manager) | Transfer your simple text into a styled and modern one (Console support only) |
72+
| [**Util**](#tools-kit-utilities) | A collection of functions that everyone use in one simple line |
7073

71-
## Tools-Kit Hastebin Client
74+
## Hastebin Client
7275

7376
With Tools-Kit [**Hastebin**][hastebin] Client you can post and fetch code easily from [**Hastebin**][hastebin].
7477

@@ -96,10 +99,9 @@ hastebin.post('var test = \'test\';\n\nconsole.log(test);', '.js')
9699
});
97100
```
98101

99-
## Tools-Kit Logger Manager
102+
## Logger Manager
100103

101104
With Tools-Kit Logger Manager you can log a styled and colored text into the console with pre made logging settings in each method.
102-
See more backgrounds, colors, styles & consoles types by clicking [here](#logger-options)
103105

104106
```javascript
105107
const { logger } = require('tools-kit');
@@ -113,18 +115,18 @@ logger.important('Important log');
113115
logger.success('Success log');
114116
// Console > [20/02/2020 - 00:00:00 | SUCCESS]: Success log
115117

116-
logger.debug('Debugging log');
117-
// Console > [20/02/2020 - 00:00:00 | DEBUG]: Debugging log
118-
119-
logger.error('Error log');
120-
// Console > [20/02/2020 - 00:00:00 | ERROR]: Error log
121-
122118
logger.fatal('Fatal log');
123119
// Console > [20/02/2020 - 00:00:00 | FATAL]: Fatal log
124120

125121
logger.trace('Trace log');
126122
// Console > [20/02/2020 - 00:00:00 | TRACE]: Trace log
127123

124+
logger.error('Error log');
125+
// Console > [20/02/2020 - 00:00:00 | ERROR]: Error log
126+
127+
logger.debug('Debug log');
128+
// Console > [20/02/2020 - 00:00:00 | DEBUG]: Debugging log
129+
128130
logger.info('Information log');
129131
// Console > [20/02/2020 - 00:00:00 | INFO]: Information log
130132

@@ -153,9 +155,9 @@ Settings custom styling options:
153155
```javascript
154156
const { logger } = require('tools-kit');
155157

156-
const settings = { // Support custom log options
158+
const settings = { // Support custom logging options
157159
background: 'black',
158-
color: 'blue',
160+
color: 'bMagenta',
159161
style: 'bold',
160162
type: 'info',
161163
time: true,
@@ -191,7 +193,9 @@ logger // Support chain logging
191193
*/
192194
```
193195

194-
## Tools-Kit Color Manager
196+
See more backgrounds, colors, styles & consoles types by clicking [**here**](#logger-options)
197+
198+
## Color Manager
195199

196200
With Tools-Kit Color Manager you can transfer your simple text into a styled and modern one.
197201

@@ -224,30 +228,63 @@ logger.log({ tag: 'ZEBRA' }, color.zebra('zebra styled-text'), 'normal text');
224228
// Console > [20/02/2020 - 00:00:00 | ZEBRA]: zebra styled-text zebra styled-text normal text
225229
```
226230

227-
## Tools-Kit Utilities
231+
## Utilities
228232

229233
With Tools-Kit Utilities you can use the functions that everyone uses in one simple line.
230234

231235
```javascript
232236
const { logger, util } = require('tools-kit');
233237

234-
logger.log({ tag: 'OBJECT?' }, util.isObject(new Array()));
235-
// Console > [20/02/2020 - 00:00:00 | OBJECT?]: false
238+
logger.log({ tag: 'HAS?' }, util.has({ name: 'test' }, 'name'));
239+
// Console > [20/02/2020 - 00:00:00 | HAS?]: true
240+
241+
logger.log({ tag: 'HAS?' }, util.has({ name: 'test' }, 'test'));
242+
// Console > [20/02/2020 - 00:00:00 | HAS?]: false
243+
244+
logger.log({ tag: 'HAS?' }, util.has({ name: 'test' }, 'name', 'test'));
245+
// Console > [20/02/2020 - 00:00:00 | HAS?]: true
246+
247+
logger.log({ tag: 'HAS?' }, util.has({ name: 'test' }, 'name', 'not test'));
248+
// Console > [20/02/2020 - 00:00:00 | HAS?]: false
249+
250+
logger.log({ tag: 'HAS?' }, util.has(['name', 'test'], 'name'));
251+
// Console > [20/02/2020 - 00:00:00 | HAS?]: true
252+
253+
logger.log({ tag: 'HAS?' }, util.has(['test', 'not test'], 'name'));
254+
// Console > [20/02/2020 - 00:00:00 | HAS?]: false
255+
256+
logger.log({ tag: 'ARRAY?' }, util.isArray(new Array()));
257+
// Console > [20/02/2020 - 00:00:00 | ARRAY?]: true
258+
259+
logger.log({ tag: 'ARRAY?' }, util.isArray(new Object()));
260+
// Console > [20/02/2020 - 00:00:00 | ARRAY?]: false
261+
262+
logger.log({ tag: 'ARRAY?' }, util.isArray([]));
263+
// Console > [20/02/2020 - 00:00:00 | ARRAY?]: true
264+
265+
logger.log({ tag: 'ARRAY?' }, util.isArray({}));
266+
// Console > [20/02/2020 - 00:00:00 | ARRAY?]: false
236267

237268
logger.log({ tag: 'OBJECT?' }, util.isObject(new Object()));
238269
// Console > [20/02/2020 - 00:00:00 | OBJECT?]: true
239270

240-
logger.log({ tag: 'OBJECT?' }, util.isObject([]));
271+
logger.log({ tag: 'OBJECT?' }, util.isObject(new Array()));
241272
// Console > [20/02/2020 - 00:00:00 | OBJECT?]: false
242273

243274
logger.log({ tag: 'OBJECT?' }, util.isObject({}));
244275
// Console > [20/02/2020 - 00:00:00 | OBJECT?]: true
245276

277+
logger.log({ tag: 'OBJECT?' }, util.isObject([]));
278+
// Console > [20/02/2020 - 00:00:00 | OBJECT?]: false
279+
246280
logger.log({ tag: 'RANDOM ITEM' }, util.randomItem(['cat', 'dog', 'fish']));
247-
// Console > [20/02/2020 - 00:00:00 | OBJECT?]: dog
281+
// Console > [20/02/2020 - 00:00:00 | RANDOM ITEM]: dog
248282

249283
logger.log({ tag: 'RANDOM NUMBER' }, util.randomNumber(5, 10));
250-
// Console > [20/02/2020 - 00:00:00 | OBJECT?]: 7
284+
// Console > [20/02/2020 - 00:00:00 | RANDOM ITEM]: 7
285+
286+
logger.log({ tag: 'RANDOM NUMBER' }, util.randomNumber(5, 10, false)); // Default is true
287+
// Console > [20/02/2020 - 00:00:00 | RANDOM ITEM]: 9.051817302079687
251288
```
252289

253290
## Logger Options
@@ -314,41 +351,42 @@ logger.log({ tag: 'RANDOM NUMBER' }, util.randomNumber(5, 10));
314351

315352
### options.time
316353

317-
- The `options.time` can be either of this two:
318-
- `Boolean` (true/false) - If to include the current time with the stock format when logging
319-
- `String` ([moment][moment] time format) - A custom moment time format to use when logging
354+
#### The `options.time` can be either of this two
355+
356+
- `Boolean` (true/false) - If to include the current time and date with the stock format when logging (Stock used [**moment**][moment] format: DD/M/YYYY - H:mm:ss)
357+
- `String` - A custom [**moment**][moment] time format to use when logging
320358

321359
### options.tag
322360

323-
- The `options.tag` can be either of this two:
361+
#### The `options.tag` can be either of this two
362+
324363
- `Boolean` (true/false) - If to include the a tag when logging
325-
- `String` - A custom string value to use as a tag when logging
364+
- `String` - A custom string value to use as a tag when logging (Case sensitive)
326365

327-
## License
366+
# Documentations
328367

329-
[**MIT**][license]
368+
Read the [**Documentations**][documentations] for more information about each method.
330369

331-
## Changelog
370+
# Maintainers
332371

333-
See the [**Changes Log**][changelog] for more information about each update.
372+
- [**BlackB1RD**][blackb1rd]
373+
- [**JamesParkDev**][james]
334374

335-
## Documentations
375+
# Changelog
336376

337-
Read the [**Documentations**][documentations] for more information about each method.
377+
See the [**Changes Log**][changelog] for more information about each update.
338378

339-
## Related Modules
379+
# License
340380

341-
- [node-fetch][node-fetch] — A light-weight module that brings window.fetch to Node.js.
342-
- [moment][moment] — A lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.
343-
- [figlet][figlet] — Creates ASCII Art from text. A full implementation of the FIGfont spec.
381+
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FBlackB1RD-Development%2Ftools-kit.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FBlackB1RD-Development%2Ftools-kit?ref=badge_large)
344382

345-
## Maintainers
383+
# Related Modules
346384

347-
- [BlackB1RD][blackb1rd]
348-
- [JamesParkDev][james]
385+
- [**node-fetch**][node-fetch] — A light-weight module that brings window.fetch to Node.js.
386+
- [**moment**][moment] — A lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.
387+
- [**figlet**][figlet] — Creates ASCII Art from text. A full implementation of the FIGfont spec.
349388

350389
[hastebin]:https://hastebin.com/about.md
351-
[license]:https://github.com/BlackB1RD-Development/tools-kit/blob/master/LICENSE.md
352390
[changelog]:https://github.com/BlackB1RD-Development/tools-kit/blob/master/CHANGELOG.md
353391
[documentations]:https://tools-kit.js.org/api
354392
[node-fetch]: https://www.npmjs.com/package/node-fetch

examples/LoggerManager.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ logger.important('Important log');
1515
logger.success('Success log');
1616
// Console > [20/02/2020 - 00:00:00 | SUCCESS]: Success log
1717

18-
logger.debug('Debugging log');
19-
// Console > [20/02/2020 - 00:00:00 | DEBUG]: Debugging log
20-
21-
logger.error('Error log');
22-
// Console > [20/02/2020 - 00:00:00 | ERROR]: Error log
23-
2418
logger.fatal('Fatal log');
2519
// Console > [20/02/2020 - 00:00:00 | FATAL]: Fatal log
2620

2721
logger.trace('Trace log');
2822
// Console > [20/02/2020 - 00:00:00 | TRACE]: Trace log
2923

24+
logger.error('Error log');
25+
// Console > [20/02/2020 - 00:00:00 | ERROR]: Error log
26+
27+
logger.debug('Debug log');
28+
// Console > [20/02/2020 - 00:00:00 | DEBUG]: Debugging log
29+
3030
logger.info('Information log');
3131
// Console > [20/02/2020 - 00:00:00 | INFO]: Information log
3232

@@ -49,9 +49,9 @@ Console > [20/02/2020 - 00:00:00 | FIGLET]: |_| |___\____|_____|_____| |_|
4949
Console > [20/02/2020 - 00:00:00 | FIGLET]:
5050
*/
5151

52-
const settings = { // Support custom log options
52+
const settings = { // Support custom logging options
5353
background: 'black',
54-
color: 'blue',
54+
color: 'bMagenta',
5555
style: 'bold',
5656
type: 'info',
5757
time: true,

examples/UtilUtilities.js

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,68 @@
66
// Requires - Files
77
const { logger, util } = require('..');
88

9-
logger.log({ tag: 'OBJECT?' }, util.isObject(new Array()));
10-
// Console > [20/02/2020 - 00:00:00 | OBJECT?]: false
9+
logger.log({ tag: 'HAS?' }, util.has({}, 'name'));
10+
// Console > [20/02/2020 - 00:00:00 | HAS?]: false
11+
12+
logger.log({ tag: 'HAS?' }, util.has([], 'name'));
13+
// Console > [20/02/2020 - 00:00:00 | HAS?]: false
14+
15+
logger.log({ tag: 'HAS?' }, util.has({ name: 'test' }, 'name'));
16+
// Console > [20/02/2020 - 00:00:00 | HAS?]: true
17+
18+
logger.log({ tag: 'HAS?' }, util.has({ name: 'test' }, 'test'));
19+
// Console > [20/02/2020 - 00:00:00 | HAS?]: false
20+
21+
logger.log({ tag: 'HAS?' }, util.has({ name: 'test' }, 'name', 'test'));
22+
// Console > [20/02/2020 - 00:00:00 | HAS?]: true
23+
24+
logger.log({ tag: 'HAS?' }, util.has({ name: 'test' }, 'name', 'not test'));
25+
// Console > [20/02/2020 - 00:00:00 | HAS?]: false
26+
27+
logger.log({ tag: 'HAS?' }, util.has(['name', 'test'], 'name'));
28+
// Console > [20/02/2020 - 00:00:00 | HAS?]: true
29+
30+
logger.log({ tag: 'HAS?' }, util.has(['test', 'not test'], 'name'));
31+
// Console > [20/02/2020 - 00:00:00 | HAS?]: false
32+
33+
logger.log({ tag: 'HAS?' }, util.has([{ 'name': 'not test' }, { 'name': 'test' }], 'name'));
34+
// Console > [20/02/2020 - 00:00:00 | HAS?]: true
35+
36+
logger.log({ tag: 'HAS?' }, util.has([{ 'name': 'not test' }, { 'name': 'test' }], 'test', 'name'));
37+
// Console > [20/02/2020 - 00:00:00 | HAS?]: false
38+
39+
logger.log({ tag: 'HAS?' }, util.has([{ 'name': 'not test' }, { 'name': 'test' }], 'name', 'test'));
40+
// Console > [20/02/2020 - 00:00:00 | HAS?]: true
41+
42+
logger.log({ tag: 'ARRAY?' }, util.isArray(new Array()));
43+
// Console > [20/02/2020 - 00:00:00 | ARRAY?]: true
44+
45+
logger.log({ tag: 'ARRAY?' }, util.isArray(new Object()));
46+
// Console > [20/02/2020 - 00:00:00 | ARRAY?]: false
47+
48+
logger.log({ tag: 'ARRAY?' }, util.isArray([]));
49+
// Console > [20/02/2020 - 00:00:00 | ARRAY?]: true
50+
51+
logger.log({ tag: 'ARRAY?' }, util.isArray({}));
52+
// Console > [20/02/2020 - 00:00:00 | ARRAY?]: false
1153

1254
logger.log({ tag: 'OBJECT?' }, util.isObject(new Object()));
1355
// Console > [20/02/2020 - 00:00:00 | OBJECT?]: true
1456

15-
logger.log({ tag: 'OBJECT?' }, util.isObject([]));
57+
logger.log({ tag: 'OBJECT?' }, util.isObject(new Array()));
1658
// Console > [20/02/2020 - 00:00:00 | OBJECT?]: false
1759

1860
logger.log({ tag: 'OBJECT?' }, util.isObject({}));
1961
// Console > [20/02/2020 - 00:00:00 | OBJECT?]: true
2062

63+
logger.log({ tag: 'OBJECT?' }, util.isObject([]));
64+
// Console > [20/02/2020 - 00:00:00 | OBJECT?]: false
65+
2166
logger.log({ tag: 'RANDOM ITEM' }, util.randomItem(['cat', 'dog', 'fish']));
22-
// Console > [20/02/2020 - 00:00:00 | OBJECT?]: dog
67+
// Console > [20/02/2020 - 00:00:00 | RANDOM ITEM]: dog
2368

2469
logger.log({ tag: 'RANDOM NUMBER' }, util.randomNumber(5, 10));
25-
// Console > [20/02/2020 - 00:00:00 | OBJECT?]: 7
70+
// Console > [20/02/2020 - 00:00:00 | RANDOM ITEM]: 7
71+
72+
logger.log({ tag: 'RANDOM NUMBER' }, util.randomNumber(5, 10, false)); // Default is true
73+
// Console > [20/02/2020 - 00:00:00 | RANDOM ITEM]: 9.051817302079687

lib/Clients/Hastebin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Hastebin {
2020
* @returns {Promise<Object>} Hastebin Object
2121
*/
2222
static post(code, extension) {
23-
if (!code) return new Error('The code argument is required.');
23+
if (!code) throw new Error('The code argument is required.');
2424

2525
extension = extension ? extension.startsWith('.') ? extension : `.${extension}` : null;
2626

@@ -61,9 +61,9 @@ class Hastebin {
6161
* @returns {Promise<Object>} Hastebin Object
6262
*/
6363
static get(url) {
64-
if (!url) return new Error('The URL argument is required.');
65-
else if (typeof url !== 'string') return new Error('The URL argument must be a string.');
66-
else if (!hastebinURLS.regex.test(url)) return new Error('Invalid URL argument.');
64+
if (!url) throw new Error('The URL argument is required.');
65+
else if (typeof url !== 'string') throw new Error('The URL argument must be a string.');
66+
else if (!hastebinURLS.regex.test(url)) throw new Error('Invalid URL argument.');
6767

6868
const link = {
6969
extension: url.replace(hastebinURLS.regex, '').includes('.') ? `.${url.replace(hastebinURLS.regex, '').split('.').pop()}` : '',

0 commit comments

Comments
 (0)