qsu 1.1.2 → 1.1.4

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
1
+ MIT License
2
2
 
3
- Copyright (c) jooy2.
3
+ Copyright (c) 2022 jooy2 <jooy2.contact@gmail.com> (https://jooy2.com).
4
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:
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
11
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
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
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
@@ -2,69 +2,56 @@
2
2
 
3
3
  ![logo](logo.webp)
4
4
 
5
- ### Node.js Quick & Simple Utility for JavaScript
6
-
7
- <table>
8
- <tr>
9
- <td>📑</td>
10
- <td>
11
-
12
- [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jooy2/qsu/blob/master/LICENSE)
13
- ![Programming Language Usage](https://img.shields.io/github/languages/top/jooy2/qsu)
14
- ![Commit Count](https://img.shields.io/github/commit-activity/y/jooy2/qsu)
15
- ![Line Count](https://img.shields.io/tokei/lines/github/jooy2/qsu)
16
-
17
- </td>
18
- </tr>
19
- <tr>
20
- <td>📊</td>
21
- <td>
22
-
23
- [![npm downloads](https://img.shields.io/npm/dm/qsu.svg)](https://www.npmjs.com/package/qsu)
24
- [![npm latest package](https://img.shields.io/npm/v/qsu/latest.svg)](https://www.npmjs.com/package/qsu)
25
- ![npm maintenance](https://img.shields.io/npms-io/maintenance-score/qsu)
26
- ![npm quality](https://img.shields.io/npms-io/quality-score/qsu)
27
- ![minified size](https://img.shields.io/bundlephobia/min/qsu)
28
- ![github repo size](https://img.shields.io/github/repo-size/jooy2/qsu)
29
-
30
- </td>
31
- </tr>
32
- <tr>
33
- <td>💕</td>
34
- <td>
35
-
36
- [![Followers](https://img.shields.io/github/followers/jooy2?style=social)](https://github.com/jooy2)
37
- ![Stars](https://img.shields.io/github/stars/jooy2/qsu?style=social)
38
-
39
- </td>
40
- </tr>
41
- </table>
5
+ ### Quick & Simple Utility for NodeJS
42
6
 
43
- </div>
7
+ > [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jooy2/qsu/blob/master/LICENSE) ![Programming Language Usage](https://img.shields.io/github/languages/top/jooy2/qsu) ![Commit Count](https://img.shields.io/github/commit-activity/y/jooy2/qsu) ![Line Count](https://img.shields.io/tokei/lines/github/jooy2/qsu) [![npm downloads](https://img.shields.io/npm/dm/qsu.svg)](https://www.npmjs.com/package/qsu) [![npm latest package](https://img.shields.io/npm/v/qsu/latest.svg)](https://www.npmjs.com/package/qsu) ![npm maintenance](https://img.shields.io/npms-io/maintenance-score/qsu) ![npm quality](https://img.shields.io/npms-io/quality-score/qsu) ![minified size](https://img.shields.io/bundlephobia/min/qsu) ![github repo size](https://img.shields.io/github/repo-size/jooy2/qsu) [![Followers](https://img.shields.io/github/followers/jooy2?style=social)](https://github.com/jooy2) ![Stars](https://img.shields.io/github/stars/jooy2/qsu?style=social)
44
8
 
45
- 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.
9
+ </div>
46
10
 
47
- **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.
11
+ **Qsu** is an underscore-based utility library optimized for the **[NodeJS](https://nodejs.org)** development environment. It is supported in one module without the need to separately write frequently used methods for each project.
48
12
 
49
- Some solutions partially referenced external documentation (e.g. [Stack Overflow](https://stackoverflow.com)).
13
+ - Lightweight and fast!
14
+ - Easy to install and use.
15
+ - 100% optimized for the latest NodeJS and ESM environments.
16
+ - Useful features for websites and web applications
50
17
 
51
18
  # Installation
52
19
 
53
- Qsu requires **Node.js 12.x** or higher, and the repository is serviced through **[NPM](https://npmjs.com)**.
20
+ Qsu requires `Node.js 12.x` or higher, and the repository is serviced through **[NPM](https://npmjs.com)**.
54
21
 
55
22
  After configuring the node environment, you can simply run the following command.
56
23
 
57
24
  ```bash
25
+ # via npm
58
26
  $ npm install qsu
27
+
28
+ # via yarn
29
+ $ yarn add qsu
30
+
31
+ # via pnpm
32
+ $ pnpm install qsu
33
+ ```
34
+
35
+ # How to use
36
+
37
+ ### Using named import (Multiple utilities in a single require) - Recommend
38
+
39
+ ```javascript
40
+ import { today, strCount } from 'qsu';
41
+
42
+ function main() {
43
+ console.log(today()); // '20xx-xx-xx'
44
+ console.log(strCount('123412341234', '1')); // 3
45
+ }
59
46
  ```
60
47
 
61
- # Usage
48
+ ### Using whole class (multiple utilities simultaneously with one object)
62
49
 
63
50
  ```javascript
64
51
  import _ from 'qsu';
65
52
 
66
53
  function main() {
67
- console.log(_.today()); // '20xx-xx-xx'
54
+ console.log(_.today()); // '20xx-xx-xx'
68
55
  }
69
56
  ```
70
57
 
@@ -80,10 +67,34 @@ Sleep function using Promise.
80
67
  await _.sleep(1000); // 1s
81
68
 
82
69
  _.sleep(5000).then(() => {
83
- // continue
70
+ // continue
84
71
  });
85
72
  ```
86
73
 
74
+ ### `_.funcTimes (any[])`
75
+
76
+ Repeat iteratee n (times argument value) times. After the return result of each function is stored in the array in order, the final array is returned.
77
+
78
+ - `times::number`
79
+ - `iteratee::function`
80
+
81
+ ```javascript
82
+ function sayHi(str) {
83
+ return `Hi${str || ''}`;
84
+ }
85
+
86
+ _.funcTimes(3, sayHi); // Returns ['Hi', 'Hi', 'Hi']
87
+ _.funcTimes(4, () => sayHi('!')); // Returns ['Hi!', 'Hi!', 'Hi!', 'Hi!']
88
+ ```
89
+
90
+ ### `_.getPlatform (string)`
91
+
92
+ Returns the operating system of the currently running process as a human-friendly string.
93
+
94
+ ```javascript
95
+ _.getPlatform(); // Returns 'Windows'
96
+ ```
97
+
87
98
  ### `_.numRandom (number)`
88
99
 
89
100
  Returns a random number (Between min and max).
@@ -142,15 +153,15 @@ _.today('/'); // Returns YYYY/MM/DD
142
153
  _.today('/', false); // Returns DD/MM/YYYY
143
154
  ```
144
155
 
145
- ### `_.isRealDate (boolean)`
156
+ ### `_.isValidDate (boolean)`
146
157
 
147
158
  Checks if a given date actually exists. Check only in YYYY-MM-DD format.
148
159
 
149
160
  - `date::string|Date`
150
161
 
151
162
  ```javascript
152
- _.isRealDate('2021-01-01'); // Returns true
153
- _.isRealDate('2021-02-30'); // Returns false
163
+ _.isValidDate('2021-01-01'); // Returns true
164
+ _.isValidDate('2021-02-30'); // Returns false
154
165
  ```
155
166
 
156
167
  ### `_.arrShuffle (any[])`
@@ -220,6 +231,28 @@ Moves the position of a specific element in an array to the specified position.
220
231
  _.arrMove([1, 2, 3, 4], 1, 0); // Returns [2, 1, 3, 4]
221
232
  ```
222
233
 
234
+ ### `_.arrTo1dArray (any[])`
235
+
236
+ Merges all elements of a multidimensional array into a one-dimensional array.
237
+
238
+ - `array::any[]`
239
+
240
+ ```javascript
241
+ _.arrTo1dArray([1, 2, [3, 4]], 5); // Returns [1, 2, 3, 4, 5]
242
+ ```
243
+
244
+ ### `_.arrRepeat (any[])`
245
+
246
+ Repeats the data of an `Array` or `Object` a specific number of times and returns it as a 1d array.
247
+
248
+ - `array::any[]|object`
249
+ - `count::number`
250
+
251
+ ```javascript
252
+ _.arrRepeat([1, 2, 3, 4], 3); // Returns [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
253
+ _.arrRepeat({ a: 1, b: 2 }, 2); // Returns [{ a: 1, b: 2 }, { a: 1, b: 2 }]
254
+ ```
255
+
223
256
  ### `_.trim (string)`
224
257
 
225
258
  Removes leading and trailing spaces, and returns a value converted from two or more spaces between strings to one space. If the removeAllSpace value is true, all spaces including one space are removed.
@@ -432,6 +465,17 @@ Remove duplicate characters from a given string and output only one.
432
465
  _.strUnique('aaabbbcc'); // Returns 'abc'
433
466
  ```
434
467
 
468
+ ### `_.isObject (boolean)`
469
+
470
+ Check whether the given data is of type `Object`. Returns `false` for other data types including `Array`.
471
+
472
+ - `data::any`
473
+
474
+ ```javascript
475
+ _.isObject([1, 2, 3]); // Returns false
476
+ _.isObject({ a: 1, b: 2 }); // Returns true
477
+ ```
478
+
435
479
  ### `_.isEqual (boolean)`
436
480
 
437
481
  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.
@@ -633,11 +677,11 @@ Returns text in a specific license format based on the author information of the
633
677
 
634
678
  ```javascript
635
679
  _.license({
636
- holder: 'example',
637
- email: 'example@example.com',
638
- yearStart: 2020,
639
- yearEnd: 2021,
640
- htmlBr: true
680
+ holder: 'example',
681
+ email: 'example@example.com',
682
+ yearStart: 2020,
683
+ yearEnd: 2021,
684
+ htmlBr: true
641
685
  });
642
686
  ```
643
687
 
@@ -647,4 +691,4 @@ You can report issues on [GitHub Issue Tracker](https://github.com/jooy2/qsu/iss
647
691
 
648
692
  # License
649
693
 
650
- Copyright © 2021-2022 Jooy2 Released under the MIT license.
694
+ Copyright © 2021-2022 [Jooy2](https://jooy2.com) <[jooy2.contact@gmail.com](mailto:jooy2.contact@gmail.com)> Released under the MIT license.
package/dist/index.d.ts CHANGED
@@ -9,18 +9,24 @@ declare interface LicenseOption {
9
9
  declare type PositiveNumber<N extends number> = number extends N ? N : `${N}` extends `-${string}` ? never : N;
10
10
  export default class Qsu {
11
11
  static sleep<N extends number>(delay: PositiveNumber<N>): Promise<void>;
12
+ static funcTimes<N extends number>(times: PositiveNumber<N>, iteratee: any): Array<any>;
13
+ static getPlatform(): string;
12
14
  static numRandom(min: number, max: number): number;
13
- static sum(...args: number[]): number;
14
- static mul(...args: number[]): number;
15
+ static sum(...args: any[]): number;
16
+ static sum(...args: Array<number>): number;
17
+ static mul(...args: any[]): number;
18
+ static mul(...args: Array<number>): number;
15
19
  static dayDiff(date1: Date, date2?: Date): number;
16
20
  static today(separator?: string, yearFirst?: boolean): string;
17
- static isRealDate(date: string | Date): boolean;
21
+ static isValidDate(date: string | Date): boolean;
18
22
  static arrShuffle(array: any[]): any[];
19
23
  static arrWithDefault(defaultValue: any, length?: number): any[];
20
24
  static arrUnique(array: any[]): any[];
21
25
  static arrWithNumber(start: number, end: number): number[];
22
26
  static average(array: number[]): number;
23
27
  static arrMove<N extends number>(array: any[], from: PositiveNumber<N>, to: PositiveNumber<N>): any[];
28
+ static arrTo1dArray(array: any[]): any[];
29
+ static arrRepeat<N extends number>(array: any, count: PositiveNumber<N>): any[];
24
30
  static trim(str: string, removeAllSpace?: boolean): string;
25
31
  static removeSpecialChar(str: string, withoutSpace?: boolean): string;
26
32
  static removeNewLine(str: string, replaceTo?: string): string;
@@ -31,6 +37,7 @@ export default class Qsu {
31
37
  static strRandom<N extends number>(length: PositiveNumber<N>, additionalCharacters?: string): string;
32
38
  static strBlindRandom<N extends number>(str: string, blindLength: PositiveNumber<N>, blindStr?: string): string;
33
39
  static truncate<N extends number>(str: string, length: PositiveNumber<N>, ellipsis?: string): string;
40
+ static split(str: string, ...splitter: any[]): string[];
34
41
  static split(str: string, ...splitter: Array<string>): string[];
35
42
  static encrypt(str: string, secret: string, algorithm?: string, ivSize?: number): string;
36
43
  static decrypt(str: string, secret: string, algorithm?: string): string;
@@ -40,6 +47,7 @@ export default class Qsu {
40
47
  static encodeBase64(str: string): string;
41
48
  static decodeBase64(encodedStr: string): string;
42
49
  static strUnique(str: string): string;
50
+ static isObject(data: any): boolean;
43
51
  static isEqual(leftOperand: any, ...rightOperand: Array<any>): boolean;
44
52
  static isEqualStrict(leftOperand: any, ...rightOperand: Array<any>): boolean;
45
53
  static isEmpty(data?: any): boolean;
@@ -58,3 +66,4 @@ export default class Qsu {
58
66
  static license(options: LicenseOption): string;
59
67
  }
60
68
  export { Qsu };
69
+ export declare const sleep: typeof Qsu.sleep, funcTimes: typeof Qsu.funcTimes, getPlatform: typeof Qsu.getPlatform, numRandom: typeof Qsu.numRandom, sum: typeof Qsu.sum, mul: typeof Qsu.mul, dayDiff: typeof Qsu.dayDiff, today: typeof Qsu.today, isValidDate: typeof Qsu.isValidDate, arrShuffle: typeof Qsu.arrShuffle, arrWithDefault: typeof Qsu.arrWithDefault, arrUnique: typeof Qsu.arrUnique, arrWithNumber: typeof Qsu.arrWithNumber, arrRepeat: typeof Qsu.arrRepeat, average: typeof Qsu.average, arrMove: typeof Qsu.arrMove, arrTo1dArray: typeof Qsu.arrTo1dArray, trim: typeof Qsu.trim, removeSpecialChar: typeof Qsu.removeSpecialChar, removeNewLine: typeof Qsu.removeNewLine, capitalizeFirst: typeof Qsu.capitalizeFirst, capitalizeEachWords: typeof Qsu.capitalizeEachWords, strCount: typeof Qsu.strCount, strShuffle: typeof Qsu.strShuffle, strRandom: typeof Qsu.strRandom, strBlindRandom: typeof Qsu.strBlindRandom, truncate: typeof Qsu.truncate, split: typeof Qsu.split, encrypt: typeof Qsu.encrypt, decrypt: typeof Qsu.decrypt, md5: typeof Qsu.md5, sha1: typeof Qsu.sha1, sha256: typeof Qsu.sha256, encodeBase64: typeof Qsu.encodeBase64, decodeBase64: typeof Qsu.decodeBase64, strUnique: typeof Qsu.strUnique, isObject: typeof Qsu.isObject, isEqual: typeof Qsu.isEqual, isEqualStrict: typeof Qsu.isEqualStrict, isEmpty: typeof Qsu.isEmpty, isUrl: typeof Qsu.isUrl, contains: typeof Qsu.contains, is2dArray: typeof Qsu.is2dArray, between: typeof Qsu.between, len: typeof Qsu.len, isBotAgent: typeof Qsu.isBotAgent, numberFormat: typeof Qsu.numberFormat, fileName: typeof Qsu.fileName, fileSize: typeof Qsu.fileSize, fileExt: typeof Qsu.fileExt, msToTime: typeof Qsu.msToTime, secToTime: typeof Qsu.secToTime, license: typeof Qsu.license;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{basename as t,extname as e,win32 as r}from"path";import{randomBytes as o,createCipheriv as n,createDecipheriv as i,createHash as a}from"crypto";export default class s{static sleep(t){return new Promise((e=>{setTimeout(e,t)}))}static numRandom(t,e){if(!t&&!e)return Math.random()>.5?1:0;const r=e||t,o=!e||t>=e?null:t;return Math.floor(Math.random()*(o?r-o+1:r+1))+(o||0)}static sum(...t){const e=t.length>0&&"object"==typeof t[0]?t[0]:t;let r=0;for(let t=0,o=e.length;t<o;t+=1)"number"==typeof e[t]&&(r+=e[t]);return r}static mul(...t){const e=t.length>0&&"object"==typeof t[0]?t[0]:t;let r=e[0];for(let t=1,o=e.length;t<o;t+=1)"number"==typeof e[t]&&(r*=e[t]);return r}static dayDiff(t,e){const r=e||new Date;return Math.ceil(Math.abs(r.getTime()-t.getTime())/864e5)}static today(t="-",e=!0){const r=new Date,o=r.getMonth()+1,n=r.getDate(),i=[`${o<10?"0":""}${o}`,`${n<10?"0":""}${n}`];return e?i.unshift(r.getFullYear().toString()):i.push(r.getFullYear().toString()),i.join(t)}static isRealDate(t){const e="string"==typeof t?new Date(t):t;return!!e.getTime()&&e.toISOString().slice(0,10)===t}static arrShuffle(t){if(1===t.length)return t[0];const e=t;for(let r=t.length-1;r>0;r-=1){const o=Math.floor(Math.random()*(r+1));[e[r],e[o]]=[t[o],t[r]]}return e}static arrWithDefault(t,e=0){return e<1?[]:Array(e).fill(t)}static arrUnique(t){return this.is2dArray(t)?t.map((t=>JSON.stringify(t))).reverse().filter(((t,e,r)=>-1===r.indexOf(t,e+1))).reverse().map((t=>JSON.parse(t))):[...new Set(t)]}static arrWithNumber(t,e){if(t>e)throw new Error("end is greater than start.");return Array.from({length:e-t+1},((e,r)=>r+t))}static average(t){return t.reduce(((t,e)=>t+e),0)/t.length}static arrMove(t,e,r){const o=t.length;if(o<=e||o<=r)throw new Error("Invalid move params");return t.splice(r,0,t.splice(e,1)[0]),t}static trim(t,e=!1){return t.trim().replace(e?/\s+/g:/\s{2,}/g,"")}static removeSpecialChar(t,e){return t?t.replace(new RegExp(`[^a-zA-Z가-힣ㄱ-ㅎㅏ-ㅣ0-9぀-ヿ㐀-䶿一-鿿豈-﫿ヲ-゚${e?" ":""}]`,"gi"),""):""}static removeNewLine(t,e=""){return t?t.replace(/(\r\n|\n|\r)/gm,e).trim():""}static capitalizeFirst(t){return t?t.charAt(0).toUpperCase()+t.slice(1):""}static capitalizeEachWords(t,e){if(!t)return"";const r=t.trim().toLowerCase().split(" ");for(let t=0,o=r.length;t<o;t+=1)e&&this.contains(r[t],["in","on","the","at","and","or","of","for","to","that","a","by","it","is","as","are","were","was","nor","an"],!0)||(r[t]=this.capitalizeFirst(r[t]));return this.capitalizeFirst(r.join(" "))}static strCount(t,e){if(!t||!e)return 0;let r=0,o=t.indexOf(e);for(;o>-1;)r+=1,o=t.indexOf(e,o+=e.length);return r}static strShuffle(t){return t?[...t].sort((()=>Math.random()-.5)).join(""):""}static strRandom(t,e){const r=`abcdefghijklmnopqrstuvwxyz0123456789${e}`,o=r.length;let n,i="";for(let e=0;e<t;e+=1)n=r.charAt(Math.floor(Math.random()*o)),n=Math.random()<.5?n.toUpperCase():n,i+=n;return i}static strBlindRandom(t,e,r="*"){if(!t)return"";let o=t,n=0,i=0,a=0;const s=o.length;for(;n<e&&a<s;)i=this.numRandom(0,s),/[a-zA-Z가-힣]/.test(o.substring(i,i+1))&&(o=`${o.substring(0,i+1)}${r}${o.substring(i+2)}`,n+=1),a+=1;return o}static truncate(t,e,r=""){if(!t)return"";let o=t;return t.length>e&&(o=t.substring(0,e)+r),o}static split(t,...e){if(!t)return[];const r=e.length>0&&"object"==typeof e[0]?e[0]:e,o=r.length;let n="",i="";for(let t=0;t<o;t+=1){const e=r[t];e.length>1?i+=`${i.length<1?"":"|"}${e.replace(/\\/g,"\\\\").replace(/\[/g,"\\[").replace(/]/g,"\\]").replace(/\?/g,"\\?").replace(/\./g,"\\.").replace(/\{/g,"\\{").replace(/}/g,"\\}").replace(/\+/g,"\\+")}`:n+="-"===e||"["===e||"]"===e?`\\${e}`:e}return n.length<1&&i.length<1?[t]:(n.length>0&&(n=`[${n}]`,i.length>0&&(i=`|${i}`)),t.split(new RegExp(`${n}${i}+`,"gi")))}static encrypt(t,e,r="aes-256-cbc",i=16){if(!t||t.length<1)return"";const a=o(i),s=n(r,e,a);let c=s.update(t);return c=Buffer.concat([c,s.final()]),`${a.toString("hex")}:${c.toString("hex")}`}static decrypt(t,e,r="aes-256-cbc"){if(!t||t.length<1)return"";const o=t.split(":"),n=i(r,e,Buffer.from(o.shift(),"hex"));let a=n.update(Buffer.from(o.join(":"),"hex"));return a=Buffer.concat([a,n.final()]),a.toString()}static md5(t){return a("md5").update(t).digest("hex")}static sha1(t){return a("sha1").update(t).digest("hex")}static sha256(t){return a("sha256").update(t).digest("hex")}static encodeBase64(t){return Buffer.from(t,"utf8").toString("base64")}static decodeBase64(t){return Buffer.from(t,"base64").toString("utf8")}static strUnique(t){return t?[...new Set(t)].join(""):""}static isEqual(t,...e){const r=e.length>0&&"object"==typeof e[0]?e[0]:e,o=r.length;for(let e=0;e<o;e+=1)if(r[e]!=t)return!1;return!0}static isEqualStrict(t,...e){const r=e.length>0&&"object"==typeof e[0]?e[0]:e,o=r.length;for(let e=0;e<o;e+=1)if(r[e]!==t)return!1;return!0}static isEmpty(t){if(!t)return!0;switch(typeof t){case"string":return t.length<1;case"object":return Array.isArray(t)?t.length<1:Object.keys(t).length<1;default:return!1}}static isUrl(t,e=!1,r=!1){if(r&&-1===t.indexOf("."))return!1;try{new URL(`${e&&-1===t.indexOf("://")?"https://":""}${t}`).toString()}catch(t){return!1}return!0}static contains(t,e,r=!1){if("string"==typeof e)return!(t.length<1)&&-1!==t.indexOf(e);for(let o=0,n=e.length;o<n;o+=1)if(r){if(t===e[o])return!0}else if(-1!==t.indexOf(e[o]))return!0;return!1}static is2dArray(t){return t.filter(Array.isArray).length>0}static between(t,e,r=!1){const o=Math.min.apply(Math,[t[0],t[1]]),n=Math.max.apply(Math,[t[0],t[1]]);return r?e>=o&&e<=n:e>o&&e<n}static len(t){if(!t)return 0;switch(typeof t){case"object":return Array.isArray(t)?t.length:Object.keys(t).length;case"number":case"bigint":return t.toString().length;case"boolean":return t?4:5;case"function":return t().length;default:return t.length}}static isBotAgent(t){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|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|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(t)}static numberFormat(t){return(new Intl.NumberFormat).format(t)}static fileName(o,n=!1){return o?-1===o.indexOf("/")?n?r.basename(o):r.basename(o,e(o)):n?t(o):t(o,e(o)):""}static fileSize(t,e=2){if(!t||0===t||t<0)return"0 Bytes";const r=Math.floor(Math.log(t)/Math.log(1024));return`${parseFloat((t/1024**r).toFixed(e<0?0:e))} ${["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][r]}`}static fileExt(t){if(-1===t.indexOf("."))return"Unknown";const e=t.trim().toLowerCase().split(".");return e.length>0?e[e.length-1]:"Unknown"}static msToTime(t=0,e=!1,r=":"){const o=Math.floor(t%1e3/100);let n=Math.floor(t/1e3%60),i=Math.floor(t/6e4%60),a=Math.floor(t/36e5);return a=a<10?`0${a}`:a,i=i<10?`0${i}`:i,n=n<10?`0${n}`:n,`${a}${r}${i}${r}${n}${e?`.${o}`:""}`}static secToTime(t=0,e=!1,r=":"){let o=Math.floor(t%60),n=Math.floor(t/60%60),i=Math.floor(t/3600);return i=i<10?`0${i}`:i,n=n<10?`0${n}`:n,o=o<10?`0${o}`:o,e?i.toString():`${i}${r}${n}${r}${o}`}static license(t){const e=t.htmlBr?"<br/>":"\n",r=`${t.yearStart}${t.yearEnd?`-${t.yearEnd}`:""}`,o=`${t.author}${t.email?` <${t.email}>`:""}`;return"apache20"===t.type.replace(/\.-_,\s/g,"").toLowerCase()?`Copyright ${r} ${o}${e}${e}Licensed under the Apache License, Version 2.0 (the "License");${e}you may not use this file except in compliance with the License.${e}You may obtain a copy of the License at${e}${e} http://www.apache.org/licenses/LICENSE-2.0${e}${e}Unless required by applicable law or agreed to in writing, software${e}distributed under the License is distributed on an "AS IS" BASIS,${e}WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.${e}See the License for the specific language governing permissions and${e}limitations under the License.`:`Copyright (c) ${r} ${o}${e}${e}Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:${e}${e}The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.${e}${e}THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.`}}export{s as Qsu};
1
+ import{basename as t,extname as e,win32 as r}from"path";import{randomBytes as a,createCipheriv as i,createDecipheriv as n,createHash as o}from"crypto";export default class s{static sleep(t){return new Promise((e=>{setTimeout(e,t)}))}static funcTimes(t,e){const r=[];for(let a=0;a<t;a+=1)r[a]="function"==typeof e?e.call():e;return r}static getPlatform(){switch(process.platform){case"win32":return"Windows";case"darwin":return"macOS";case"linux":case"aix":case"sunos":case"netbsd":case"openbsd":case"freebsd":case"cygwin":case"android":return"Linux";default:return"Unknown"}}static numRandom(t,e){if(!t&&!e)return Math.random()>.5?1:0;const r=e||t,a=!e||t>=e?null:t;return Math.floor(Math.random()*(a?r-a+1:r+1))+(a||0)}static sum(...t){const e=t.length>0&&"object"==typeof t[0]?t[0]:t;let r=0;for(let t=0,a=e.length;t<a;t+=1)"number"==typeof e[t]&&(r+=e[t]);return r}static mul(...t){const e=t.length>0&&"object"==typeof t[0]?t[0]:t;let r=e[0];for(let t=1,a=e.length;t<a;t+=1)"number"==typeof e[t]&&(r*=e[t]);return r}static dayDiff(t,e){const r=e||new Date;return Math.ceil(Math.abs(r.getTime()-t.getTime())/864e5)}static today(t="-",e=!0){const r=new Date,a=r.getMonth()+1,i=r.getDate(),n=[`${a<10?"0":""}${a}`,`${i<10?"0":""}${i}`];return e?n.unshift(r.getFullYear().toString()):n.push(r.getFullYear().toString()),n.join(t)}static isValidDate(t){const e="string"==typeof t?new Date(t):t;return!!e.getTime()&&e.toISOString().slice(0,10)===t}static arrShuffle(t){if(1===t.length)return t[0];const e=t;for(let r=t.length-1;r>0;r-=1){const a=Math.floor(Math.random()*(r+1));[e[r],e[a]]=[t[a],t[r]]}return e}static arrWithDefault(t,e=0){return e<1?[]:Array(e).fill(t)}static arrUnique(t){return s.is2dArray(t)?t.map((t=>JSON.stringify(t))).reverse().filter(((t,e,r)=>-1===r.indexOf(t,e+1))).reverse().map((t=>JSON.parse(t))):[...new Set(t)]}static arrWithNumber(t,e){if(t>e)throw new Error("end is greater than start.");return Array.from({length:e-t+1},((e,r)=>r+t))}static average(t){return t.reduce(((t,e)=>t+e),0)/t.length}static arrMove(t,e,r){const a=t.length;if(a<=e||a<=r)throw new Error("Invalid move params");return t.splice(r,0,t.splice(e,1)[0]),t}static arrTo1dArray(t){const e=t=>{const r=[],a=t.length;for(let i=0;i<a;i+=1)"object"!=typeof t[i]?r.push(t[i]):s.is2dArray(t[i])?r.push(...e(t[i])):r.push(...t[i]);return r};return e(t)}static arrRepeat(t,e){if(!t||e<1||"object"!=typeof t)return[];const r=s.isObject(t),a=[];for(let i=0,n=e;i<n;i+=1)r?a.push(t):a.push(...t);return a}static trim(t,e=!1){return t.trim().replace(e?/\s+/g:/\s{2,}/g,"")}static removeSpecialChar(t,e){return t?t.replace(new RegExp(`[^a-zA-Z가-힣ㄱ-ㅎㅏ-ㅣ0-9぀-ヿ㐀-䶿一-鿿豈-﫿ヲ-゚${e?" ":""}]`,"gi"),""):""}static removeNewLine(t,e=""){return t?t.replace(/(\r\n|\n|\r)/gm,e).trim():""}static capitalizeFirst(t){return t?t.charAt(0).toUpperCase()+t.slice(1):""}static capitalizeEachWords(t,e){if(!t)return"";const r=t.trim().toLowerCase().split(" ");for(let t=0,a=r.length;t<a;t+=1)e&&s.contains(r[t],["in","on","the","at","and","or","of","for","to","that","a","by","it","is","as","are","were","was","nor","an"],!0)||(r[t]=s.capitalizeFirst(r[t]));return s.capitalizeFirst(r.join(" "))}static strCount(t,e){if(!t||!e)return 0;let r=0,a=t.indexOf(e);for(;a>-1;)r+=1,a=t.indexOf(e,a+=e.length);return r}static strShuffle(t){return t?[...t].sort((()=>Math.random()-.5)).join(""):""}static strRandom(t,e){const r=`abcdefghijklmnopqrstuvwxyz0123456789${e}`,a=r.length;let i,n="";for(let e=0;e<t;e+=1)i=r.charAt(Math.floor(Math.random()*a)),i=Math.random()<.5?i.toUpperCase():i,n+=i;return n}static strBlindRandom(t,e,r="*"){if(!t)return"";let a=t,i=0,n=0,o=0;const c=a.length;for(;i<e&&o<c;)n=s.numRandom(0,c),/[a-zA-Z가-힣]/.test(a.substring(n,n+1))&&(a=`${a.substring(0,n+1)}${r}${a.substring(n+2)}`,i+=1),o+=1;return a}static truncate(t,e,r=""){if(!t)return"";let a=t;return t.length>e&&(a=t.substring(0,e)+r),a}static split(t,...e){if(!t)return[];const r=e.length>0&&"object"==typeof e[0]?e[0]:e,a=r.length;let i="",n="";for(let t=0;t<a;t+=1){const e=r[t];e.length>1?n+=`${n.length<1?"":"|"}${e.replace(/\\/g,"\\\\").replace(/\[/g,"\\[").replace(/]/g,"\\]").replace(/\?/g,"\\?").replace(/\./g,"\\.").replace(/\{/g,"\\{").replace(/}/g,"\\}").replace(/\+/g,"\\+")}`:i+="-"===e||"["===e||"]"===e?`\\${e}`:e}return i.length<1&&n.length<1?[t]:(i.length>0&&(i=`[${i}]`,n.length>0&&(n=`|${n}`)),t.split(new RegExp(`${i}${n}+`,"gi")))}static encrypt(t,e,r="aes-256-cbc",n=16){if(!t||t.length<1)return"";const o=a(n),s=i(r,e,o);let c=s.update(t);return c=Buffer.concat([c,s.final()]),`${o.toString("hex")}:${c.toString("hex")}`}static decrypt(t,e,r="aes-256-cbc"){if(!t||t.length<1)return"";const a=t.split(":"),i=n(r,e,Buffer.from(a.shift(),"hex"));let o=i.update(Buffer.from(a.join(":"),"hex"));return o=Buffer.concat([o,i.final()]),o.toString()}static md5(t){return o("md5").update(t).digest("hex")}static sha1(t){return o("sha1").update(t).digest("hex")}static sha256(t){return o("sha256").update(t).digest("hex")}static encodeBase64(t){return Buffer.from(t,"utf8").toString("base64")}static decodeBase64(t){return Buffer.from(t,"base64").toString("utf8")}static strUnique(t){return t?[...new Set(t)].join(""):""}static isObject(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}static isEqual(t,...e){const r=e.length>0&&"object"==typeof e[0]?e[0]:e,a=r.length;for(let e=0;e<a;e+=1)if(r[e]!=t)return!1;return!0}static isEqualStrict(t,...e){const r=e.length>0&&"object"==typeof e[0]?e[0]:e,a=r.length;for(let e=0;e<a;e+=1)if(r[e]!==t)return!1;return!0}static isEmpty(t){if(!t)return!0;switch(typeof t){case"string":return t.length<1;case"object":return Array.isArray(t)?t.length<1:Object.keys(t).length<1;default:return!1}}static isUrl(t,e=!1,r=!1){if(r&&-1===t.indexOf("."))return!1;try{new URL(`${e&&-1===t.indexOf("://")?"https://":""}${t}`).toString()}catch(t){return!1}return!0}static contains(t,e,r=!1){if("string"==typeof e)return!(t.length<1)&&-1!==t.indexOf(e);for(let a=0,i=e.length;a<i;a+=1)if(r){if(t===e[a])return!0}else if(-1!==t.indexOf(e[a]))return!0;return!1}static is2dArray(t){return t.filter(Array.isArray).length>0}static between(t,e,r=!1){const a=Math.min.apply(Math,[t[0],t[1]]),i=Math.max.apply(Math,[t[0],t[1]]);return r?e>=a&&e<=i:e>a&&e<i}static len(t){if(!t)return 0;switch(typeof t){case"object":return Array.isArray(t)?t.length:Object.keys(t).length;case"number":case"bigint":return t.toString().length;case"boolean":return t?4:5;case"function":return t().length;default:return t.length}}static isBotAgent(t){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|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|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(t)}static numberFormat(t){return(new Intl.NumberFormat).format(t)}static fileName(a,i=!1){return a?-1===a.indexOf("/")?i?r.basename(a):r.basename(a,e(a)):i?t(a):t(a,e(a)):""}static fileSize(t,e=2){if(!t||0===t||t<0)return"0 Bytes";const r=Math.floor(Math.log(t)/Math.log(1024));return`${parseFloat((t/1024**r).toFixed(e<0?0:e))} ${["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][r]}`}static fileExt(t){if(-1===t.indexOf("."))return"Unknown";const e=t.trim().toLowerCase().split(".");return e.length>0?e[e.length-1]:"Unknown"}static msToTime(t=0,e=!1,r=":"){const a=Math.floor(t%1e3/100);let i=Math.floor(t/1e3%60),n=Math.floor(t/6e4%60),o=Math.floor(t/36e5);return o=o<10?`0${o}`:o,n=n<10?`0${n}`:n,i=i<10?`0${i}`:i,`${o}${r}${n}${r}${i}${e?`.${a}`:""}`}static secToTime(t=0,e=!1,r=":"){let a=Math.floor(t%60),i=Math.floor(t/60%60),n=Math.floor(t/3600);return n=n<10?`0${n}`:n,i=i<10?`0${i}`:i,a=a<10?`0${a}`:a,e?n.toString():`${n}${r}${i}${r}${a}`}static license(t){const e=t.htmlBr?"<br/>":"\n",r=`${t.yearStart}${t.yearEnd?`-${t.yearEnd}`:""}`,a=`${t.author}${t.email?` <${t.email}>`:""}`;return"apache20"===t.type.replace(/\.-_,\s/g,"").toLowerCase()?`Copyright ${r} ${a}${e}${e}Licensed under the Apache License, Version 2.0 (the "License");${e}you may not use this file except in compliance with the License.${e}You may obtain a copy of the License at${e}${e} http://www.apache.org/licenses/LICENSE-2.0${e}${e}Unless required by applicable law or agreed to in writing, software${e}distributed under the License is distributed on an "AS IS" BASIS,${e}WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.${e}See the License for the specific language governing permissions and${e}limitations under the License.`:`Copyright (c) ${r} ${a}${e}${e}Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:${e}${e}The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.${e}${e}THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.`}}export{s as Qsu};export const{sleep:sleep,funcTimes:funcTimes,getPlatform:getPlatform,numRandom:numRandom,sum:sum,mul:mul,dayDiff:dayDiff,today:today,isValidDate:isValidDate,arrShuffle:arrShuffle,arrWithDefault:arrWithDefault,arrUnique:arrUnique,arrWithNumber:arrWithNumber,arrRepeat:arrRepeat,average:average,arrMove:arrMove,arrTo1dArray:arrTo1dArray,trim:trim,removeSpecialChar:removeSpecialChar,removeNewLine:removeNewLine,capitalizeFirst:capitalizeFirst,capitalizeEachWords:capitalizeEachWords,strCount:strCount,strShuffle:strShuffle,strRandom:strRandom,strBlindRandom:strBlindRandom,truncate:truncate,split:split,encrypt:encrypt,decrypt:decrypt,md5:md5,sha1:sha1,sha256:sha256,encodeBase64:encodeBase64,decodeBase64:decodeBase64,strUnique:strUnique,isObject:isObject,isEqual:isEqual,isEqualStrict:isEqualStrict,isEmpty:isEmpty,isUrl:isUrl,contains:contains,is2dArray:is2dArray,between:between,len:len,isBotAgent:isBotAgent,numberFormat:numberFormat,fileName:fileName,fileSize:fileSize,fileExt:fileExt,msToTime:msToTime,secToTime:secToTime,license:license}=s;
package/package.json CHANGED
@@ -1,68 +1,74 @@
1
1
  {
2
- "name": "qsu",
3
- "version": "1.1.2",
4
- "description": "Quick and Simple Utility for JavaScript",
5
- "type": "module",
6
- "types": "dist/index.d.ts",
7
- "scripts": {
8
- "build": "npm run format:fix && tsc && npm run minify",
9
- "test": "npm run build && mocha --parallel test/*.spec.js",
10
- "lint": "eslint .",
11
- "lint:fix": "eslint --fix .",
12
- "minify": "terser dist/index.js --config-file terser.config.json -o dist/index.js",
13
- "prepare": "npm run build",
14
- "format": "prettier .",
15
- "format:fix": "prettier . --write"
16
- },
17
- "engines": {
18
- "node": ">=12.0.0"
19
- },
20
- "author": "Jooy2 <jootc.help@gmail.com>",
21
- "license": "MIT",
22
- "main": "dist/index.js",
23
- "exports": {
24
- ".": "./dist/index.js"
25
- },
26
- "typesVersions": {
27
- "*": {
28
- "index.d.ts": [
29
- "dist/index.d.ts"
30
- ]
31
- }
32
- },
33
- "repository": {
34
- "type": "git",
35
- "url": "https://github.com/jooy2/qsu"
36
- },
37
- "keywords": [
38
- "util",
39
- "utility",
40
- "tool",
41
- "underscore",
42
- "website",
43
- "helper",
44
- "array",
45
- "string",
46
- "date",
47
- "math",
48
- "verify",
49
- "encrypt",
50
- "decrypt",
51
- "format",
52
- "file"
53
- ],
54
- "devDependencies": {
55
- "@types/node": "^18.11.2",
56
- "@typescript-eslint/eslint-plugin": "^5.40.1",
57
- "@typescript-eslint/parser": "^5.40.1",
58
- "date-fns": "^2.29.3",
59
- "eslint": "^8.25.0",
60
- "eslint-config-airbnb": "^19.0.4",
61
- "eslint-config-prettier": "^8.5.0",
62
- "eslint-plugin-import": "^2.26.0",
63
- "mocha": "^10.1.0",
64
- "prettier": "^2.7.1",
65
- "terser": "^5.15.1",
66
- "typescript": "^4.8.4"
67
- }
2
+ "name": "qsu",
3
+ "version": "1.1.4",
4
+ "description": "Quick and Simple Utility for JavaScript",
5
+ "author": "Jooy2 <jooy2.contact@gmail.com>",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/jooy2/qsu",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/jooy2/qsu.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/jooy2/qsu/issues"
14
+ },
15
+ "type": "module",
16
+ "types": "dist/index.d.ts",
17
+ "scripts": {
18
+ "build": "npm run format:fix && tsc && npm run minify",
19
+ "test": "npm run build && mocha test/**/*.spec.ts -r ts-node/register --loader=ts-node/esm --timeout 10000",
20
+ "lint": "eslint .",
21
+ "lint:fix": "eslint --fix .",
22
+ "minify": "terser dist/index.js --config-file .terserrc -o dist/index.js",
23
+ "prepare": "npm run build",
24
+ "format": "prettier .",
25
+ "format:fix": "prettier . --write"
26
+ },
27
+ "engines": {
28
+ "node": ">=12.0.0"
29
+ },
30
+ "main": "dist/index.js",
31
+ "exports": {
32
+ ".": "./dist/index.js"
33
+ },
34
+ "typesVersions": {
35
+ "*": {
36
+ "index.d.ts": [
37
+ "dist/index.d.ts"
38
+ ]
39
+ }
40
+ },
41
+ "keywords": [
42
+ "util",
43
+ "utility",
44
+ "tool",
45
+ "underscore",
46
+ "website",
47
+ "helper",
48
+ "array",
49
+ "string",
50
+ "date",
51
+ "math",
52
+ "verify",
53
+ "encrypt",
54
+ "decrypt",
55
+ "format",
56
+ "file"
57
+ ],
58
+ "devDependencies": {
59
+ "@types/mocha": "^10.0.1",
60
+ "@types/node": "^18.11.17",
61
+ "@typescript-eslint/eslint-plugin": "^5.47.0",
62
+ "@typescript-eslint/parser": "^5.47.0",
63
+ "date-fns": "^2.29.3",
64
+ "eslint": "^8.30.0",
65
+ "eslint-config-airbnb": "^19.0.4",
66
+ "eslint-config-prettier": "^8.5.0",
67
+ "eslint-plugin-import": "^2.26.0",
68
+ "mocha": "^10.2.0",
69
+ "prettier": "^2.8.1",
70
+ "terser": "^5.16.1",
71
+ "ts-node": "^10.9.1",
72
+ "typescript": "^4.9.4"
73
+ }
68
74
  }
package/.prettierignore DELETED
@@ -1,4 +0,0 @@
1
- dist/
2
- .idea/
3
-
4
- package-lock.json
package/.prettierrc DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "printWidth": 100,
3
- "tabWidth": 2,
4
- "singleQuote": true,
5
- "quoteProps": "as-needed",
6
- "trailingComma": "none",
7
- "bracketSpacing": true,
8
- "bracketSameLine": false,
9
- "arrowParens": "always",
10
- "insertPragma": false,
11
- "requirePragma": false,
12
- "proseWrap": "never",
13
- "htmlWhitespaceSensitivity": "strict",
14
- "endOfLine": "lf"
15
- }