qsu 1.0.3 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,44 @@
1
+ # Change Log
2
+
3
+ ## 1.0.6 (2022-07-24)
4
+
5
+ - `isBotAgent`: Add `chrome-lighthouse` in bot lists
6
+ - `split`: Fix incorrect return type
7
+ - `isEqual`: Add new isEqual method
8
+ - `isEqualStrict`: Add new isEqualStrict method
9
+ - Import only the methods needed in the path and crypto module
10
+
11
+ ## 1.0.5 (2022-06-23)
12
+
13
+ - `contains`: When the length of the str parameter value of string type is 0, no error is thrown and false is returned
14
+
15
+ ## 1.0.4 (2022-06-16)
16
+ **NOTICE**: `convertDate` is no longer supported due to the removal of `moment` as a dependent module.
17
+
18
+ The `today` method has changed its usage. We no longer support custom date formats.
19
+
20
+ - `split`: Add new split method
21
+ - `today`: Remove dependent modules, change parameters to use pure code
22
+ - `convertDate`: Remove method
23
+ - `encrypt`, `decrypt`: Add basic validation check (more fix)
24
+
25
+ ## 1.0.3 (2022-05-24)
26
+
27
+ - `encrypt`, `decrypt`: Add basic validation check
28
+
29
+ ## 1.0.2 (2022-05-23)
30
+
31
+ - `encrypt` `decrypt`: Add basic validation check
32
+ - `strBlindRandom`: Override the deprecated substr method
33
+
34
+ ## 1.0.1 (2022-05-12)
35
+
36
+ - Minimize bundle size and clean up code
37
+
38
+ ## 1.0.0 (2022-05-09)
39
+
40
+ - First version release
41
+
42
+ ## 0.0.1 ~ 0.5.5 (2021-03-16 ~ 2022-04-09)
43
+
44
+ - This is for the Alpha release and is not recommended for use
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) jooy2.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE
1
+ MIT License
2
+
3
+ Copyright (c) jooy2.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  <div align="center">
2
2
 
3
3
  ![logo](qsu-logo.png)
4
+
4
5
  ### Node.js Quick & Simple Utility for JavaScript
5
6
 
6
7
  [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jooy2/qsu/blob/master/LICENSE)
@@ -10,19 +11,22 @@
10
11
  ![github repo size](https://img.shields.io/github/repo-size/jooy2/qsu)
11
12
  [![npm downloads](https://img.shields.io/npm/dm/qsu.svg)](https://www.npmjs.com/package/qsu)
12
13
  [![Followers](https://img.shields.io/github/followers/jooy2?style=social)](https://github.com/jooy2)
14
+ ![Stars](https://img.shields.io/github/stars/jooy2/qsu?style=social)
15
+ ![Commit Count](https://img.shields.io/github/commit-activity/y/jooy2/qsu)
16
+ ![Line Count](https://img.shields.io/tokei/lines/github/jooy2/qsu)
13
17
  </div>
14
18
 
15
- A collection of complex or useful features that are often used in JavaScript. It is implemented to be used in both a client or server environment.
19
+ A collection of complex or useful features that are often used in **JavaScript**. It is implemented to be used in both a client or server environment.
16
20
 
17
- qsu is optimized for modern development environments, so older browsers such as Internet Explorer 11 and Legacy Edge (Not Chromium) may not support it unless you use a transcompiler. Some functions use ES6 or higher JS standard syntax.
21
+ **qsu** is optimized for modern development environments, so older browsers such as Internet Explorer 11 and Legacy Edge (Not Chromium) may not support it unless you use a transcompiler. Some functions use ES6 or higher JS standard syntax.
18
22
 
19
23
  Some solutions partially referenced external documentation (e.g. [Stack Overflow](https://stackoverflow.com)).
20
24
 
21
25
  # Installation
22
- Qsu requires Node.js 14.x or higher, and the repository is serviced through NPM.
26
+ Qsu requires **Node.js 14.x** or higher, and the repository is serviced through **[NPM](https://npmjs.com)**.
23
27
  After configuring the node environment, you can simply run the following command.
24
28
  ```bash
25
- $ npm i --save qsu
29
+ $ npm i qsu
26
30
  ```
27
31
 
28
32
  # Usage
@@ -92,11 +96,13 @@ _.daydiff(new Date('2021-01-01'), new Date('2021-01-03')); // Returns 2
92
96
  ### `_.today (string)`
93
97
 
94
98
  Returns today's date.
95
- - `dateFormat::string?`
99
+ - `separator::string = '-'`
100
+ - `yearFirst::boolean = false`
96
101
 
97
102
  ```javascript
98
103
  _.today(); // Returns YYYY-MM-DD
99
- _.today('YYYY'); // Returns YYYY
104
+ _.today('/'); // Returns YYYY/MM/DD
105
+ _.today('/', false); // Returns DD/MM/YYYY
100
106
  ```
101
107
 
102
108
  ### `_.isRealDate (boolean)`
@@ -109,17 +115,6 @@ _.isRealDate('2021-01-01'); // Returns true
109
115
  _.isRealDate('2021-02-30'); // Returns false
110
116
  ```
111
117
 
112
- ### `_.convertDate (string)`
113
-
114
- Returns a date in YYYY-MM-DD or desired format based on the first argument (date in String format).
115
- - `date::string`
116
- - `format::string?`
117
-
118
- ```javascript
119
- _.convertDate('2021-01-01', 'YYYY'); // Returns 2021
120
- _.convertDate('2021', 'YYYY_MM_DD'); // Returns 2021_01_01
121
- ```
122
-
123
118
  ### `_.arrShuffle (any[])`
124
119
 
125
120
  Shuffle the order of the given array and return.
@@ -273,6 +268,19 @@ _.truncate('hello', 3); // Returns 'hel'
273
268
  _.truncate('hello', 2, '...'); // Returns 'he...'
274
269
  ```
275
270
 
271
+ ### `_.split (string[])`
272
+
273
+ Splits a string based on the specified character and returns it as an Array. Unlike the existing split, it splits the values provided as multiple parameters (array or multiple arguments) at once.
274
+ - `str::string`
275
+ - `splitter::string||string[]||...string`
276
+
277
+ ```javascript
278
+ _.split('hello% js world', '% '); // Returns ['hello', 'js world']
279
+ _.split('hello,js,world', ','); // Returns ['hello', 'js', 'world']
280
+ _.split('hello%js,world', ',', '%'); // Returns ['hello', 'js', 'world']
281
+ _.split('hello%js,world', [',', '%']); // Returns ['hello', 'js', 'world']
282
+ ```
283
+
276
284
  ### `_.encrypt (string)`
277
285
 
278
286
  Encrypt with the algorithm of your choice (algorithm default: `aes-256-cbc`, ivSize default: `16`) using a string and a secret (secret).
@@ -350,6 +358,41 @@ Remove duplicate characters from a given string and output only one.
350
358
  _.strUnique('aaabbbcc'); // Returns 'abc'
351
359
  ```
352
360
 
361
+ ### `_.isEqual (boolean)`
362
+
363
+ It compares the first argument value as the left operand and the argument values given thereafter as the right operand, and returns `true` if the values are all the same.
364
+
365
+ `isEqual` returns `true` even if the data types do not match, but `isEqualStrict` returns `true` only when the data types of all argument values match.
366
+ - `leftOperand::any`
367
+ - `rightOperand::any||any[]||...any`
368
+
369
+ ```javascript
370
+ const val1 = 'Left';
371
+ const val2 = 1;
372
+
373
+ _.isEqual('Left', 'Left', val1); // Returns true
374
+ _.isEqual(1, [1, '1', 1, val2]); // Returns true
375
+ _.isEqual(val1, ['Right', 'Left', 1]); // Returns false
376
+ _.isEqual(1, 1, 1, 1); // Returns true
377
+ ```
378
+
379
+ ### `_.isEqualStrict (boolean)`
380
+
381
+ It compares the first argument value as the left operand and the argument values given thereafter as the right operand, and returns `true` if the values are all the same.
382
+
383
+ `isEqual` returns `true` even if the data types do not match, but `isEqualStrict` returns `true` only when the data types of all argument values match.
384
+ - `leftOperand::any`
385
+ - `rightOperand::any||any[]||...any`
386
+
387
+ ```javascript
388
+ const val1 = 'Left';
389
+ const val2 = 1;
390
+
391
+ _.isEqualStrict('Left', 'Left', val1); // Returns true
392
+ _.isEqualStrict(1, [1, '1', 1, val2]); // Returns false
393
+ _.isEqualStrict(1, 1, '1', 1); // Returns false
394
+ ```
395
+
353
396
  ### `_.isEmpty (boolean)`
354
397
 
355
398
  Returns true if the passed data is empty or has a length of 0.
@@ -516,7 +559,7 @@ _.license({
516
559
  ```
517
560
 
518
561
  # Contribute
519
- You can report issues on GitHub Issue. You can also request a pull to fix bugs and add frequently used features.
562
+ You can report issues on [GitHub Issue Tracker](https://github.com/jooy2/qsu/issues). You can also request a pull to fix bugs and add frequently used features.
520
563
 
521
564
  # License
522
- Copyright © 2021 Jooy2 Released under the MIT license.
565
+ Copyright © 2021-2022 Jooy2 Released under the MIT license.
package/dist/index.d.ts CHANGED
@@ -13,9 +13,8 @@ export default class Qsu {
13
13
  static sum(...args: number[]): number;
14
14
  static mul(...args: number[]): number;
15
15
  static dayDiff(date1: Date, date2?: Date): number;
16
- static today(dateFormat?: string): string;
16
+ static today(separator?: string, yearFirst?: boolean): string;
17
17
  static isRealDate(date: string | Date): boolean;
18
- static convertDate(date: string, format?: string): string;
19
18
  static arrShuffle(array: any[]): any[];
20
19
  static arrWithDefault(defaultValue: any, length?: number): any[];
21
20
  static arrUnique(array: any[]): any[];
@@ -31,6 +30,7 @@ export default class Qsu {
31
30
  static strRandom<N extends number>(length: PositiveNumber<N>, additionalCharacters?: string): string;
32
31
  static strBlindRandom<N extends number>(str: string, blindLength: PositiveNumber<N>, blindStr?: string): string;
33
32
  static truncate<N extends number>(str: string, length: PositiveNumber<N>, ellipsis?: string): string;
33
+ static split(str: string, ...splitter: Array<string>): string[];
34
34
  static encrypt(str: string, secret: string, algorithm?: string, ivSize?: number): string;
35
35
  static decrypt(str: string, secret: string, algorithm?: string): string;
36
36
  static md5(str: string): string;
@@ -39,6 +39,8 @@ export default class Qsu {
39
39
  static encodeBase64(str: string): string;
40
40
  static decodeBase64(encodedStr: string): string;
41
41
  static strUnique(str: string): string;
42
+ static isEqual(leftOperand: any, ...rightOperand: Array<any>): boolean;
43
+ static isEqualStrict(leftOperand: any, ...rightOperand: Array<any>): boolean;
42
44
  static isEmpty(data?: any): boolean;
43
45
  static isUrl(url: string, withProtocol?: boolean, strict?: boolean): boolean;
44
46
  static contains(str: any[] | string, search: any[] | string, exact?: boolean): boolean;
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
- import moment from 'moment';
2
- import path from 'path';
3
- import crypto from 'crypto';
1
+ import { basename, extname } from 'path';
2
+ import { randomBytes, createCipheriv, createDecipheriv, createHash, } from 'crypto';
4
3
  export default class Qsu {
5
4
  /*
6
5
  * Misc
@@ -48,8 +47,21 @@ export default class Qsu {
48
47
  const date2c = date2 || new Date();
49
48
  return Math.ceil(Math.abs(date2c.getTime() - date1.getTime()) / (1000 * 3600 * 24));
50
49
  }
51
- static today(dateFormat) {
52
- return moment().format(dateFormat || 'YYYY-MM-DD');
50
+ static today(separator = '-', yearFirst = true) {
51
+ const date = new Date();
52
+ const month = date.getMonth() + 1;
53
+ const day = date.getDate();
54
+ const dateArr = [
55
+ `${month < 10 ? '0' : ''}${month}`,
56
+ `${day < 10 ? '0' : ''}${day}`,
57
+ ];
58
+ if (yearFirst) {
59
+ dateArr.unshift(date.getFullYear().toString());
60
+ }
61
+ else {
62
+ dateArr.push(date.getFullYear().toString());
63
+ }
64
+ return dateArr.join(separator);
53
65
  }
54
66
  static isRealDate(date) {
55
67
  const dateConverted = typeof date === 'string' ? new Date(date) : date;
@@ -58,9 +70,6 @@ export default class Qsu {
58
70
  }
59
71
  return dateConverted.toISOString().slice(0, 10) === date;
60
72
  }
61
- static convertDate(date, format) {
62
- return moment(date).format(format || 'YYYY-MM-DD');
63
- }
64
73
  /*
65
74
  * Array
66
75
  * */
@@ -173,12 +182,48 @@ export default class Qsu {
173
182
  }
174
183
  return convStr;
175
184
  }
185
+ static split(str, ...splitter) {
186
+ const splitters = splitter.length > 0 && typeof splitter[0] === 'object' ? splitter[0] : splitter;
187
+ const splitterLength = splitters.length;
188
+ let charPattern = '';
189
+ let strPattern = '';
190
+ for (let i = 0; i < splitterLength; i += 1) {
191
+ const spl = splitters[i];
192
+ if (spl.length > 1) {
193
+ strPattern += `${strPattern.length < 1 ? '' : '|'}${spl
194
+ .replace(/\\/g, '\\\\')
195
+ .replace(/\[/g, '\\[')
196
+ .replace(/]/g, '\\]')
197
+ .replace(/\?/g, '\\?')
198
+ .replace(/\./g, '\\.')
199
+ .replace(/\{/g, '\\{')
200
+ .replace(/}/g, '\\}')
201
+ .replace(/\+/g, '\\+')}`;
202
+ }
203
+ else if (spl === '-' || spl === '[' || spl === ']') {
204
+ charPattern += `\\${spl}`;
205
+ }
206
+ else {
207
+ charPattern += spl;
208
+ }
209
+ }
210
+ if (charPattern.length < 1 && strPattern.length < 1) {
211
+ return [str];
212
+ }
213
+ if (charPattern.length > 0) {
214
+ charPattern = `[${charPattern}]`;
215
+ if (strPattern.length > 0) {
216
+ strPattern = `|${strPattern}`;
217
+ }
218
+ }
219
+ return str.split(new RegExp(`${charPattern}${strPattern}+`, 'gi'));
220
+ }
176
221
  static encrypt(str, secret, algorithm = 'aes-256-cbc', ivSize = 16) {
177
222
  if (!str || str.length < 1) {
178
223
  return '';
179
224
  }
180
- const iv = crypto.randomBytes(ivSize);
181
- const cipher = crypto.createCipheriv(algorithm, secret, iv);
225
+ const iv = randomBytes(ivSize);
226
+ const cipher = createCipheriv(algorithm, secret, iv);
182
227
  let enc = cipher.update(str);
183
228
  enc = Buffer.concat([enc, cipher.final()]);
184
229
  return `${iv.toString('hex')}:${enc.toString('hex')}`;
@@ -188,19 +233,19 @@ export default class Qsu {
188
233
  return '';
189
234
  }
190
235
  const arrStr = str.split(':');
191
- const decipher = crypto.createDecipheriv(algorithm, secret, Buffer.from(arrStr.shift(), 'hex'));
236
+ const decipher = createDecipheriv(algorithm, secret, Buffer.from(arrStr.shift(), 'hex'));
192
237
  let decrypted = decipher.update(Buffer.from(arrStr.join(':'), 'hex'));
193
238
  decrypted = Buffer.concat([decrypted, decipher.final()]);
194
239
  return decrypted.toString();
195
240
  }
196
241
  static md5(str) {
197
- return crypto.createHash('md5').update(str).digest('hex');
242
+ return createHash('md5').update(str).digest('hex');
198
243
  }
199
244
  static sha1(str) {
200
- return crypto.createHash('sha1').update(str).digest('hex');
245
+ return createHash('sha1').update(str).digest('hex');
201
246
  }
202
247
  static sha256(str) {
203
- return crypto.createHash('sha256').update(str).digest('hex');
248
+ return createHash('sha256').update(str).digest('hex');
204
249
  }
205
250
  static encodeBase64(str) {
206
251
  return Buffer.from(str, 'utf8').toString('base64');
@@ -214,6 +259,27 @@ export default class Qsu {
214
259
  /*
215
260
  * Verify
216
261
  * */
262
+ static isEqual(leftOperand, ...rightOperand) {
263
+ const rightOperands = rightOperand.length > 0 && typeof rightOperand[0] === 'object' ? rightOperand[0] : rightOperand;
264
+ const rightOperandLength = rightOperands.length;
265
+ for (let i = 0; i < rightOperandLength; i += 1) {
266
+ // eslint-disable-next-line eqeqeq
267
+ if (rightOperands[i] != leftOperand) {
268
+ return false;
269
+ }
270
+ }
271
+ return true;
272
+ }
273
+ static isEqualStrict(leftOperand, ...rightOperand) {
274
+ const rightOperands = rightOperand.length > 0 && typeof rightOperand[0] === 'object' ? rightOperand[0] : rightOperand;
275
+ const rightOperandLength = rightOperands.length;
276
+ for (let i = 0; i < rightOperandLength; i += 1) {
277
+ if (rightOperands[i] !== leftOperand) {
278
+ return false;
279
+ }
280
+ }
281
+ return true;
282
+ }
217
283
  static isEmpty(data) {
218
284
  if (!data) {
219
285
  return true;
@@ -244,7 +310,7 @@ export default class Qsu {
244
310
  }
245
311
  static contains(str, search, exact = false) {
246
312
  if (typeof search === 'string') {
247
- return str.indexOf(search) !== -1;
313
+ return str.length < 1 ? false : str.indexOf(search) !== -1;
248
314
  }
249
315
  for (let i = 0, iLen = search.length; i < iLen; i += 1) {
250
316
  if (exact) {
@@ -286,7 +352,7 @@ export default class Qsu {
286
352
  }
287
353
  }
288
354
  static isBotAgent(userAgent) {
289
- return /bot|naverbot|google|Googlebot|Googlebot-Mobile|Googlebot-Image|Google favicon|Mediapartners-Google|bingbot|slurp|java|wget|curl|Commons-HttpClient|Python-urllib|libwww|httpunit|nutch|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|biglotron|teoma|convera|seekbot|gigablast|exabot|ngbot|ia_archiver|GingerCrawler|webmon |httrack|webcrawler|grub.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|bibnum.bnf|findlink|msrbot|panscient|yacybot|AISearchBot|IOI|ips-agent|tagoobot|MJ12bot|dotbot|woriobot|yanga|buzzbot|mlbot|yandexbot|purebot|Linguee Bot|Voyager|CyberPatrol|voilabot|baiduspider|citeseerxbot|spbot|twengabot|postrank|turnitinbot|scribdbot|page2rss|sitebot|linkdex|Adidxbot|blekkobot|ezooms|dotbot|Mail.RU_Bot|discobot|heritrix|findthatfile|europarchive.org|NerdByNature.Bot|sistrix crawler|ahrefsbot|Aboundex|domaincrawler|wbsearchbot|summify|ccbot|edisterbot|seznambot|ec2linkfinder|gslfbot|aihitbot|intelium_bot|facebookexternalhit|yeti|RetrevoPageAnalyzer|lb-spider|sogou|lssbot|careerbot|wotbox|wocbot|ichiro|DuckDuckBot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnam gnam spider|web-archive-net.com.bot|backlinkcrawler|coccoc|integromedb|content crawler spider|toplistbot|seokicks-robot|it2media-domain-crawler|ip-web-crawler.com|siteexplorer.info|elisabot|proximic|changedetection|blexbot|arabot|WeSEE:Search|niki-bot|CrystalSemanticsBot|rogerbot|360Spider|psbot|InterfaxScanBot|Lipperhey SEO Service|CC Metadata Scaper|g00g1e.net|GrapeshotCrawler|urlappendbot|brainobot|fr-crawler|binlar|SimpleCrawler|Livelapbot|Twitterbot|cXensebot|smtbot|bnf.fr_bot|A6-Indexer|ADmantX|Facebot|Twitterbot|OrangeBot|memorybot|AdvBot|MegaIndex|SemanticScholarBot|ltx71|nerdybot|xovibot|BUbiNG|Qwantify|archive.org_bot|Applebot|TweetmemeBot|crawler4j|findxbot|SemrushBot|yoozBot|lipperhey|y!j-asr|Domain Re-Animator Bot|AddThis/i.test(userAgent);
355
+ return /bot|naverbot|google|Googlebot|Googlebot-Mobile|Googlebot-Image|Google favicon|Chrome-Lighthouse|Mediapartners-Google|bingbot|slurp|java|wget|curl|Commons-HttpClient|Python-urllib|libwww|httpunit|nutch|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|biglotron|teoma|convera|seekbot|gigablast|exabot|ngbot|ia_archiver|GingerCrawler|webmon |httrack|webcrawler|grub.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|bibnum.bnf|findlink|msrbot|panscient|yacybot|AISearchBot|IOI|ips-agent|tagoobot|MJ12bot|dotbot|woriobot|yanga|buzzbot|mlbot|yandexbot|purebot|Linguee Bot|Voyager|CyberPatrol|voilabot|baiduspider|citeseerxbot|spbot|twengabot|postrank|turnitinbot|scribdbot|page2rss|sitebot|linkdex|Adidxbot|blekkobot|ezooms|dotbot|Mail.RU_Bot|discobot|heritrix|findthatfile|europarchive.org|NerdByNature.Bot|sistrix crawler|ahrefsbot|Aboundex|domaincrawler|wbsearchbot|summify|ccbot|edisterbot|seznambot|ec2linkfinder|gslfbot|aihitbot|intelium_bot|facebookexternalhit|yeti|RetrevoPageAnalyzer|lb-spider|sogou|lssbot|careerbot|wotbox|wocbot|ichiro|DuckDuckBot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnam gnam spider|web-archive-net.com.bot|backlinkcrawler|coccoc|integromedb|content crawler spider|toplistbot|seokicks-robot|it2media-domain-crawler|ip-web-crawler.com|siteexplorer.info|elisabot|proximic|changedetection|blexbot|arabot|WeSEE:Search|niki-bot|CrystalSemanticsBot|rogerbot|360Spider|psbot|InterfaxScanBot|Lipperhey SEO Service|CC Metadata Scaper|g00g1e.net|GrapeshotCrawler|urlappendbot|brainobot|fr-crawler|binlar|SimpleCrawler|Livelapbot|Twitterbot|cXensebot|smtbot|bnf.fr_bot|A6-Indexer|ADmantX|Facebot|Twitterbot|OrangeBot|memorybot|AdvBot|MegaIndex|SemanticScholarBot|ltx71|nerdybot|xovibot|BUbiNG|Qwantify|archive.org_bot|Applebot|TweetmemeBot|crawler4j|findxbot|SemrushBot|yoozBot|lipperhey|y!j-asr|Domain Re-Animator Bot|AddThis/i.test(userAgent);
290
356
  }
291
357
  /*
292
358
  * Format
@@ -296,9 +362,9 @@ export default class Qsu {
296
362
  }
297
363
  static fileName(filePath, withExtension = false) {
298
364
  if (withExtension) {
299
- return path.basename(filePath);
365
+ return basename(filePath);
300
366
  }
301
- return path.basename(filePath, path.extname(filePath));
367
+ return basename(filePath, extname(filePath));
302
368
  }
303
369
  static fileSize(bytes, decimals = 2) {
304
370
  if (bytes === 0 || bytes < 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qsu",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "description": "Quick and Simple Utility for javascript",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",
@@ -43,17 +43,15 @@
43
43
  "math"
44
44
  ],
45
45
  "devDependencies": {
46
- "@types/node": "^17.0.35",
47
- "@typescript-eslint/eslint-plugin": "^5.25.0",
48
- "@typescript-eslint/parser": "^5.25.0",
49
- "eslint": "^8.16.0",
46
+ "@types/node": "^18.0.6",
47
+ "@typescript-eslint/eslint-plugin": "^5.30.7",
48
+ "@typescript-eslint/parser": "^5.30.7",
49
+ "date-fns": "^2.29.1",
50
+ "eslint": "^8.20.0",
50
51
  "eslint-config-airbnb": "^19.0.4",
51
52
  "eslint-plugin-import": "^2.26.0",
52
53
  "mocha": "^10.0.0",
53
- "ts-node": "^10.8.0",
54
- "typescript": "^4.6.4"
55
- },
56
- "dependencies": {
57
- "moment": "^2.29.3"
54
+ "ts-node": "^10.9.1",
55
+ "typescript": "^4.7.4"
58
56
  }
59
57
  }