qsu 1.1.3 → 1.1.5
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 +17 -17
- package/README.md +79 -14
- package/dist/index.d.ts +10 -2
- package/dist/index.js +1 -1
- package/package.json +72 -68
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Copyright (c) 2021-2023 jooy2 <jooy2.contact@gmail.com> (https://jooy2.com).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
13
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
@@ -40,8 +40,8 @@ $ pnpm install qsu
|
|
|
40
40
|
import { today, strCount } from 'qsu';
|
|
41
41
|
|
|
42
42
|
function main() {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
console.log(today()); // '20xx-xx-xx'
|
|
44
|
+
console.log(strCount('123412341234', '1')); // 3
|
|
45
45
|
}
|
|
46
46
|
```
|
|
47
47
|
|
|
@@ -51,7 +51,7 @@ function main() {
|
|
|
51
51
|
import _ from 'qsu';
|
|
52
52
|
|
|
53
53
|
function main() {
|
|
54
|
-
|
|
54
|
+
console.log(_.today()); // '20xx-xx-xx'
|
|
55
55
|
}
|
|
56
56
|
```
|
|
57
57
|
|
|
@@ -67,7 +67,7 @@ Sleep function using Promise.
|
|
|
67
67
|
await _.sleep(1000); // 1s
|
|
68
68
|
|
|
69
69
|
_.sleep(5000).then(() => {
|
|
70
|
-
|
|
70
|
+
// continue
|
|
71
71
|
});
|
|
72
72
|
```
|
|
73
73
|
|
|
@@ -80,7 +80,7 @@ Repeat iteratee n (times argument value) times. After the return result of each
|
|
|
80
80
|
|
|
81
81
|
```javascript
|
|
82
82
|
function sayHi(str) {
|
|
83
|
-
|
|
83
|
+
return `Hi${str || ''}`;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
_.funcTimes(3, sayHi); // Returns ['Hi', 'Hi', 'Hi']
|
|
@@ -129,6 +129,28 @@ _.mul(1, 2, 3); // Returns 6
|
|
|
129
129
|
_.mul([1, 2, 3, 4]); // Returns 24
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
+
### `_.sub (number)`
|
|
133
|
+
|
|
134
|
+
Returns after subtracting all n arguments of numbers or the values of a single array of numbers.
|
|
135
|
+
|
|
136
|
+
- `numbers::...number[]`
|
|
137
|
+
|
|
138
|
+
```javascript
|
|
139
|
+
_.sub(10, 1, 5); // Returns 4
|
|
140
|
+
_.sub([1, 2, 3, 4]); // Returns -8
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### `_.div (number)`
|
|
144
|
+
|
|
145
|
+
Returns after dividing all n arguments of numbers or the values of a single array of numbers.
|
|
146
|
+
|
|
147
|
+
- `numbers::...number[]`
|
|
148
|
+
|
|
149
|
+
```javascript
|
|
150
|
+
_.div(10, 5, 2); // Returns 1
|
|
151
|
+
_.div([100, 2, 2, 5]); // Returns 5
|
|
152
|
+
```
|
|
153
|
+
|
|
132
154
|
### `_.dayDiff (number)`
|
|
133
155
|
|
|
134
156
|
Calculates the difference between two given dates and returns the number of days.
|
|
@@ -153,15 +175,15 @@ _.today('/'); // Returns YYYY/MM/DD
|
|
|
153
175
|
_.today('/', false); // Returns DD/MM/YYYY
|
|
154
176
|
```
|
|
155
177
|
|
|
156
|
-
### `_.
|
|
178
|
+
### `_.isValidDate (boolean)`
|
|
157
179
|
|
|
158
180
|
Checks if a given date actually exists. Check only in YYYY-MM-DD format.
|
|
159
181
|
|
|
160
182
|
- `date::string|Date`
|
|
161
183
|
|
|
162
184
|
```javascript
|
|
163
|
-
_.
|
|
164
|
-
_.
|
|
185
|
+
_.isValidDate('2021-01-01'); // Returns true
|
|
186
|
+
_.isValidDate('2021-02-30'); // Returns false
|
|
165
187
|
```
|
|
166
188
|
|
|
167
189
|
### `_.arrShuffle (any[])`
|
|
@@ -231,6 +253,28 @@ Moves the position of a specific element in an array to the specified position.
|
|
|
231
253
|
_.arrMove([1, 2, 3, 4], 1, 0); // Returns [2, 1, 3, 4]
|
|
232
254
|
```
|
|
233
255
|
|
|
256
|
+
### `_.arrTo1dArray (any[])`
|
|
257
|
+
|
|
258
|
+
Merges all elements of a multidimensional array into a one-dimensional array.
|
|
259
|
+
|
|
260
|
+
- `array::any[]`
|
|
261
|
+
|
|
262
|
+
```javascript
|
|
263
|
+
_.arrTo1dArray([1, 2, [3, 4]], 5); // Returns [1, 2, 3, 4, 5]
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### `_.arrRepeat (any[])`
|
|
267
|
+
|
|
268
|
+
Repeats the data of an `Array` or `Object` a specific number of times and returns it as a 1d array.
|
|
269
|
+
|
|
270
|
+
- `array::any[]|object`
|
|
271
|
+
- `count::number`
|
|
272
|
+
|
|
273
|
+
```javascript
|
|
274
|
+
_.arrRepeat([1, 2, 3, 4], 3); // Returns [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
|
|
275
|
+
_.arrRepeat({ a: 1, b: 2 }, 2); // Returns [{ a: 1, b: 2 }, { a: 1, b: 2 }]
|
|
276
|
+
```
|
|
277
|
+
|
|
234
278
|
### `_.trim (string)`
|
|
235
279
|
|
|
236
280
|
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.
|
|
@@ -443,6 +487,17 @@ Remove duplicate characters from a given string and output only one.
|
|
|
443
487
|
_.strUnique('aaabbbcc'); // Returns 'abc'
|
|
444
488
|
```
|
|
445
489
|
|
|
490
|
+
### `_.isObject (boolean)`
|
|
491
|
+
|
|
492
|
+
Check whether the given data is of type `Object`. Returns `false` for other data types including `Array`.
|
|
493
|
+
|
|
494
|
+
- `data::any`
|
|
495
|
+
|
|
496
|
+
```javascript
|
|
497
|
+
_.isObject([1, 2, 3]); // Returns false
|
|
498
|
+
_.isObject({ a: 1, b: 2 }); // Returns true
|
|
499
|
+
```
|
|
500
|
+
|
|
446
501
|
### `_.isEqual (boolean)`
|
|
447
502
|
|
|
448
503
|
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.
|
|
@@ -555,6 +610,16 @@ _.len('12345'); // Returns 5
|
|
|
555
610
|
_.len([1, 2, 3]); // Returns 3
|
|
556
611
|
```
|
|
557
612
|
|
|
613
|
+
### `_.isEmail (boolean)`
|
|
614
|
+
|
|
615
|
+
Checks if the given argument value is a valid email.
|
|
616
|
+
|
|
617
|
+
- `email::string`
|
|
618
|
+
|
|
619
|
+
```javascript
|
|
620
|
+
_.isEmail('abc@def.com'); // Returns true
|
|
621
|
+
```
|
|
622
|
+
|
|
558
623
|
### `_.isBotAgent (boolean)`
|
|
559
624
|
|
|
560
625
|
Analyze the user agent value to determine if it's a bot for a search engine. Returns `true` if it's a bot.
|
|
@@ -644,11 +709,11 @@ Returns text in a specific license format based on the author information of the
|
|
|
644
709
|
|
|
645
710
|
```javascript
|
|
646
711
|
_.license({
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
712
|
+
holder: 'example',
|
|
713
|
+
email: 'example@example.com',
|
|
714
|
+
yearStart: 2020,
|
|
715
|
+
yearEnd: 2021,
|
|
716
|
+
htmlBr: true
|
|
652
717
|
});
|
|
653
718
|
```
|
|
654
719
|
|
|
@@ -658,4 +723,4 @@ You can report issues on [GitHub Issue Tracker](https://github.com/jooy2/qsu/iss
|
|
|
658
723
|
|
|
659
724
|
# License
|
|
660
725
|
|
|
661
|
-
Copyright © 2021-
|
|
726
|
+
Copyright © 2021-2023 [Jooy2](https://jooy2.com) <[jooy2.contact@gmail.com](mailto:jooy2.contact@gmail.com)> Released under the MIT license.
|
package/dist/index.d.ts
CHANGED
|
@@ -16,15 +16,21 @@ export default class Qsu {
|
|
|
16
16
|
static sum(...args: Array<number>): number;
|
|
17
17
|
static mul(...args: any[]): number;
|
|
18
18
|
static mul(...args: Array<number>): number;
|
|
19
|
+
static sub(...args: any[]): number;
|
|
20
|
+
static sub(...args: Array<number>): number;
|
|
21
|
+
static div(...args: any[]): number;
|
|
22
|
+
static div(...args: Array<number>): number;
|
|
19
23
|
static dayDiff(date1: Date, date2?: Date): number;
|
|
20
24
|
static today(separator?: string, yearFirst?: boolean): string;
|
|
21
|
-
static
|
|
25
|
+
static isValidDate(date: string | Date): boolean;
|
|
22
26
|
static arrShuffle(array: any[]): any[];
|
|
23
27
|
static arrWithDefault(defaultValue: any, length?: number): any[];
|
|
24
28
|
static arrUnique(array: any[]): any[];
|
|
25
29
|
static arrWithNumber(start: number, end: number): number[];
|
|
26
30
|
static average(array: number[]): number;
|
|
27
31
|
static arrMove<N extends number>(array: any[], from: PositiveNumber<N>, to: PositiveNumber<N>): any[];
|
|
32
|
+
static arrTo1dArray(array: any[]): any[];
|
|
33
|
+
static arrRepeat<N extends number>(array: any, count: PositiveNumber<N>): any[];
|
|
28
34
|
static trim(str: string, removeAllSpace?: boolean): string;
|
|
29
35
|
static removeSpecialChar(str: string, withoutSpace?: boolean): string;
|
|
30
36
|
static removeNewLine(str: string, replaceTo?: string): string;
|
|
@@ -45,6 +51,7 @@ export default class Qsu {
|
|
|
45
51
|
static encodeBase64(str: string): string;
|
|
46
52
|
static decodeBase64(encodedStr: string): string;
|
|
47
53
|
static strUnique(str: string): string;
|
|
54
|
+
static isObject(data: any): boolean;
|
|
48
55
|
static isEqual(leftOperand: any, ...rightOperand: Array<any>): boolean;
|
|
49
56
|
static isEqualStrict(leftOperand: any, ...rightOperand: Array<any>): boolean;
|
|
50
57
|
static isEmpty(data?: any): boolean;
|
|
@@ -53,6 +60,7 @@ export default class Qsu {
|
|
|
53
60
|
static is2dArray(array: any[]): boolean;
|
|
54
61
|
static between(range: [number, number], number: number, inclusive?: boolean): boolean;
|
|
55
62
|
static len(data: any): number;
|
|
63
|
+
static isEmail(email: string): boolean;
|
|
56
64
|
static isBotAgent(userAgent: string): boolean;
|
|
57
65
|
static numberFormat(number: number): string;
|
|
58
66
|
static fileName(filePath: string, withExtension?: boolean): string;
|
|
@@ -63,4 +71,4 @@ export default class Qsu {
|
|
|
63
71
|
static license(options: LicenseOption): string;
|
|
64
72
|
}
|
|
65
73
|
export { Qsu };
|
|
66
|
-
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,
|
|
74
|
+
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, sub: typeof Qsu.sub, div: typeof Qsu.div, 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, isEmail: typeof Qsu.isEmail, 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 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 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 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 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 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,isRealDate:isRealDate,arrShuffle:arrShuffle,arrWithDefault:arrWithDefault,arrUnique:arrUnique,arrWithNumber:arrWithNumber,average:average,arrMove:arrMove,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,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;
|
|
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 sub(...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 div(...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 isEmail(t){return/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(t)}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,sub:sub,div:div,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,isEmail:isEmail,isBotAgent:isBotAgent,numberFormat:numberFormat,fileName:fileName,fileSize:fileSize,fileExt:fileExt,msToTime:msToTime,secToTime:secToTime,license:license}=s;
|
package/package.json
CHANGED
|
@@ -1,70 +1,74 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
2
|
+
"name": "qsu",
|
|
3
|
+
"version": "1.1.5",
|
|
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.19",
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "^5.50.0",
|
|
62
|
+
"@typescript-eslint/parser": "^5.51.0",
|
|
63
|
+
"date-fns": "^2.29.3",
|
|
64
|
+
"eslint": "^8.33.0",
|
|
65
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
66
|
+
"eslint-config-prettier": "^8.6.0",
|
|
67
|
+
"eslint-plugin-import": "^2.27.5",
|
|
68
|
+
"mocha": "^10.2.0",
|
|
69
|
+
"prettier": "^2.8.3",
|
|
70
|
+
"terser": "^5.16.3",
|
|
71
|
+
"ts-node": "^10.9.1",
|
|
72
|
+
"typescript": "^4.9.5"
|
|
73
|
+
}
|
|
70
74
|
}
|