qsu 1.1.4 → 1.1.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/LICENSE +1 -1
- package/README.md +79 -3
- package/dist/index.d.ts +13 -2
- package/dist/index.js +1 -1
- package/package.json +10 -10
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2021-2023 jooy2 <jooy2.contact@gmail.com> (https://jooy2.com).
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -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.
|
|
@@ -155,15 +177,48 @@ _.today('/', false); // Returns DD/MM/YYYY
|
|
|
155
177
|
|
|
156
178
|
### `_.isValidDate (boolean)`
|
|
157
179
|
|
|
158
|
-
Checks if a given date actually exists. Check only in YYYY-MM-DD format.
|
|
180
|
+
Checks if a given date actually exists. Check only in `YYYY-MM-DD` format.
|
|
159
181
|
|
|
160
|
-
- `date::string
|
|
182
|
+
- `date::string`
|
|
161
183
|
|
|
162
184
|
```javascript
|
|
163
185
|
_.isValidDate('2021-01-01'); // Returns true
|
|
164
186
|
_.isValidDate('2021-02-30'); // Returns false
|
|
165
187
|
```
|
|
166
188
|
|
|
189
|
+
### `_.dateToYYYYMMDD (string)`
|
|
190
|
+
|
|
191
|
+
Returns the date data of a Date object in the format `YYYY-MM-DD`.
|
|
192
|
+
|
|
193
|
+
- `date::Date`
|
|
194
|
+
- `separator:string`
|
|
195
|
+
|
|
196
|
+
```javascript
|
|
197
|
+
_.dateToYYYYMMDD(new Date(2023, 11, 31)); // Returns '2023-12-31'
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### `_.createDateListFromRange (string[])`
|
|
201
|
+
|
|
202
|
+
Create an array list of all dates from `startDate` to `endDate` in the format `YYYY-MM-DD`.
|
|
203
|
+
|
|
204
|
+
- `startDate::Date`
|
|
205
|
+
- `endDate::Date`
|
|
206
|
+
|
|
207
|
+
```javascript
|
|
208
|
+
_.createDateListFromRange(new Date('2023-01-01T01:00:00Z'), new Date('2023-01-05T01:00:00Z'));
|
|
209
|
+
|
|
210
|
+
/*
|
|
211
|
+
Returns:
|
|
212
|
+
[
|
|
213
|
+
'2023-01-01',
|
|
214
|
+
'2023-01-02',
|
|
215
|
+
'2023-01-03',
|
|
216
|
+
'2023-01-04',
|
|
217
|
+
'2023-01-05'
|
|
218
|
+
]
|
|
219
|
+
*/
|
|
220
|
+
```
|
|
221
|
+
|
|
167
222
|
### `_.arrShuffle (any[])`
|
|
168
223
|
|
|
169
224
|
Shuffle the order of the given array and return.
|
|
@@ -253,6 +308,17 @@ _.arrRepeat([1, 2, 3, 4], 3); // Returns [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
|
|
|
253
308
|
_.arrRepeat({ a: 1, b: 2 }, 2); // Returns [{ a: 1, b: 2 }, { a: 1, b: 2 }]
|
|
254
309
|
```
|
|
255
310
|
|
|
311
|
+
### `_.arrCount (object)`
|
|
312
|
+
|
|
313
|
+
Returns the number of duplicates for each unique value in the given array. The array values can only be of type `String` or `Number`.
|
|
314
|
+
|
|
315
|
+
- `array::string[]|number[]`
|
|
316
|
+
- `count::number`
|
|
317
|
+
|
|
318
|
+
```javascript
|
|
319
|
+
_.arrCount(['a', 'a', 'a', 'b', 'c', 'b', 'a', 'd']); // Returns { a: 4, b: 2, c: 1, d: 1 }
|
|
320
|
+
```
|
|
321
|
+
|
|
256
322
|
### `_.trim (string)`
|
|
257
323
|
|
|
258
324
|
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.
|
|
@@ -588,6 +654,16 @@ _.len('12345'); // Returns 5
|
|
|
588
654
|
_.len([1, 2, 3]); // Returns 3
|
|
589
655
|
```
|
|
590
656
|
|
|
657
|
+
### `_.isEmail (boolean)`
|
|
658
|
+
|
|
659
|
+
Checks if the given argument value is a valid email.
|
|
660
|
+
|
|
661
|
+
- `email::string`
|
|
662
|
+
|
|
663
|
+
```javascript
|
|
664
|
+
_.isEmail('abc@def.com'); // Returns true
|
|
665
|
+
```
|
|
666
|
+
|
|
591
667
|
### `_.isBotAgent (boolean)`
|
|
592
668
|
|
|
593
669
|
Analyze the user agent value to determine if it's a bot for a search engine. Returns `true` if it's a bot.
|
|
@@ -691,4 +767,4 @@ You can report issues on [GitHub Issue Tracker](https://github.com/jooy2/qsu/iss
|
|
|
691
767
|
|
|
692
768
|
# License
|
|
693
769
|
|
|
694
|
-
Copyright © 2021-
|
|
770
|
+
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
|
@@ -7,6 +7,9 @@ declare interface LicenseOption {
|
|
|
7
7
|
type: 'mit' | 'apache20';
|
|
8
8
|
}
|
|
9
9
|
declare type PositiveNumber<N extends number> = number extends N ? N : `${N}` extends `-${string}` ? never : N;
|
|
10
|
+
declare type NumberValueObject = {
|
|
11
|
+
[key: string]: number;
|
|
12
|
+
};
|
|
10
13
|
export default class Qsu {
|
|
11
14
|
static sleep<N extends number>(delay: PositiveNumber<N>): Promise<void>;
|
|
12
15
|
static funcTimes<N extends number>(times: PositiveNumber<N>, iteratee: any): Array<any>;
|
|
@@ -16,9 +19,15 @@ export default class Qsu {
|
|
|
16
19
|
static sum(...args: Array<number>): number;
|
|
17
20
|
static mul(...args: any[]): number;
|
|
18
21
|
static mul(...args: Array<number>): number;
|
|
22
|
+
static sub(...args: any[]): number;
|
|
23
|
+
static sub(...args: Array<number>): number;
|
|
24
|
+
static div(...args: any[]): number;
|
|
25
|
+
static div(...args: Array<number>): number;
|
|
19
26
|
static dayDiff(date1: Date, date2?: Date): number;
|
|
20
27
|
static today(separator?: string, yearFirst?: boolean): string;
|
|
21
|
-
static isValidDate(
|
|
28
|
+
static isValidDate(dateYYYYMMDD: string): boolean;
|
|
29
|
+
static dateToYYYYMMDD(date: Date, separator?: string): string;
|
|
30
|
+
static createDateListFromRange(startDate: Date, endDate: Date): string[];
|
|
22
31
|
static arrShuffle(array: any[]): any[];
|
|
23
32
|
static arrWithDefault(defaultValue: any, length?: number): any[];
|
|
24
33
|
static arrUnique(array: any[]): any[];
|
|
@@ -27,6 +36,7 @@ export default class Qsu {
|
|
|
27
36
|
static arrMove<N extends number>(array: any[], from: PositiveNumber<N>, to: PositiveNumber<N>): any[];
|
|
28
37
|
static arrTo1dArray(array: any[]): any[];
|
|
29
38
|
static arrRepeat<N extends number>(array: any, count: PositiveNumber<N>): any[];
|
|
39
|
+
static arrCount(array: string[] | number[]): NumberValueObject;
|
|
30
40
|
static trim(str: string, removeAllSpace?: boolean): string;
|
|
31
41
|
static removeSpecialChar(str: string, withoutSpace?: boolean): string;
|
|
32
42
|
static removeNewLine(str: string, replaceTo?: string): string;
|
|
@@ -56,6 +66,7 @@ export default class Qsu {
|
|
|
56
66
|
static is2dArray(array: any[]): boolean;
|
|
57
67
|
static between(range: [number, number], number: number, inclusive?: boolean): boolean;
|
|
58
68
|
static len(data: any): number;
|
|
69
|
+
static isEmail(email: string): boolean;
|
|
59
70
|
static isBotAgent(userAgent: string): boolean;
|
|
60
71
|
static numberFormat(number: number): string;
|
|
61
72
|
static fileName(filePath: string, withExtension?: boolean): string;
|
|
@@ -66,4 +77,4 @@ export default class Qsu {
|
|
|
66
77
|
static license(options: LicenseOption): string;
|
|
67
78
|
}
|
|
68
79
|
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;
|
|
80
|
+
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, dateToYYYYMMDD: typeof Qsu.dateToYYYYMMDD, createDateListFromRange: typeof Qsu.createDateListFromRange, arrShuffle: typeof Qsu.arrShuffle, arrWithDefault: typeof Qsu.arrWithDefault, arrUnique: typeof Qsu.arrUnique, arrWithNumber: typeof Qsu.arrWithNumber, arrRepeat: typeof Qsu.arrRepeat, arrCount: typeof Qsu.arrCount, 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 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;
|
|
1
|
+
import{basename as t,extname as e,win32 as r}from"path";import{randomBytes as a,createCipheriv as o,createDecipheriv as n,createHash as i}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,o=r.getDate(),n=[`${a<10?"0":""}${a}`,`${o<10?"0":""}${o}`];return e?n.unshift(r.getFullYear().toString()):n.push(r.getFullYear().toString()),n.join(t)}static isValidDate(t){if(!/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(t))throw new Error("The date format must be 'YYYY-MM-DD'");const e=t.split("-");return/^(?=\d)(?:(?:31(?!.(?:0?[2469]|11))|(?:30|29)(?!.0?2)|29(?=.0?2.(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(?:\x20|$))|(?:2[0-8]|1\d|0?[1-9]))([-./])(?:1[012]|0?[1-9])\1(?:1[6-9]|[2-9]\d)?\d\d(?:(?=\x20\d)\x20|$))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\x20[AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/.test(`${parseInt(e[2],10)}-${parseInt(e[1],10)}-${parseInt(e[0],10)}`)}static dateToYYYYMMDD(t,e="-"){const r=t.getMonth()+1,a=t.getDate();return`${t.getFullYear()}${e}${r<10?`0${r}`:r}${e}${a<10?`0${a}`:a}`}static createDateListFromRange(t,e){if(!s.isValidDate(s.dateToYYYYMMDD(t))||!s.isValidDate(s.dateToYYYYMMDD(e)))throw new Error("Either the start date or end date is an invalid date.");if(Math.floor((Date.parse(e.toString())-Date.parse(t.toString()))/864e5)<0)throw new Error("The start date is more recent than the end date.");const r=s.dateToYYYYMMDD(e),a=[];let o=t.getFullYear(),n=t.getMonth()+1,i=t.getDate(),c="";const l=(t,e,r)=>`${t}-${e<10?"0":""}${e}-${r<10?"0":""}${r}`;for(;r!==c;){-1!==c.indexOf("-12-31")&&(o+=1,n=1,i=1);const t=l(o,n,i);s.isValidDate(t)?(i+=1,a.push(t),c=t):(n+=1,i=1,c=l(o,n,i))}return a}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 o=0;o<a;o+=1)"object"!=typeof t[o]?r.push(t[o]):s.is2dArray(t[o])?r.push(...e(t[o])):r.push(...t[o]);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 o=0,n=e;o<n;o+=1)r?a.push(t):a.push(...t);return a}static arrCount(t){const e={};return t.forEach((t=>{e[t]=(e[t]||0)+1})),e}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 o,n="";for(let e=0;e<t;e+=1)o=r.charAt(Math.floor(Math.random()*a)),o=Math.random()<.5?o.toUpperCase():o,n+=o;return n}static strBlindRandom(t,e,r="*"){if(!t)return"";let a=t,o=0,n=0,i=0;const c=a.length;for(;o<e&&i<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)}`,o+=1),i+=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 o="",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,"\\+")}`:o+="-"===e||"["===e||"]"===e?`\\${e}`:e}return o.length<1&&n.length<1?[t]:(o.length>0&&(o=`[${o}]`,n.length>0&&(n=`|${n}`)),t.split(new RegExp(`${o}${n}+`,"gi")))}static encrypt(t,e,r="aes-256-cbc",n=16){if(!t||t.length<1)return"";const i=a(n),s=o(r,e,i);let c=s.update(t);return c=Buffer.concat([c,s.final()]),`${i.toString("hex")}:${c.toString("hex")}`}static decrypt(t,e,r="aes-256-cbc"){if(!t||t.length<1)return"";const a=t.split(":"),o=n(r,e,Buffer.from(a.shift(),"hex"));let i=o.update(Buffer.from(a.join(":"),"hex"));return i=Buffer.concat([i,o.final()]),i.toString()}static md5(t){return i("md5").update(t).digest("hex")}static sha1(t){return i("sha1").update(t).digest("hex")}static sha256(t){return i("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,o=e.length;a<o;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]]),o=Math.max.apply(Math,[t[0],t[1]]);return r?e>=a&&e<=o:e>a&&e<o}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,o=!1){return a?-1===a.indexOf("/")?o?r.basename(a):r.basename(a,e(a)):o?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 o=Math.floor(t/1e3%60),n=Math.floor(t/6e4%60),i=Math.floor(t/36e5);return i=i<10?`0${i}`:i,n=n<10?`0${n}`:n,o=o<10?`0${o}`:o,`${i}${r}${n}${r}${o}${e?`.${a}`:""}`}static secToTime(t=0,e=!1,r=":"){let a=Math.floor(t%60),o=Math.floor(t/60%60),n=Math.floor(t/3600);return n=n<10?`0${n}`:n,o=o<10?`0${o}`:o,a=a<10?`0${a}`:a,e?n.toString():`${n}${r}${o}${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,dateToYYYYMMDD:dateToYYYYMMDD,createDateListFromRange:createDateListFromRange,arrShuffle:arrShuffle,arrWithDefault:arrWithDefault,arrUnique:arrUnique,arrWithNumber:arrWithNumber,arrRepeat:arrRepeat,arrCount:arrCount,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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qsu",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Quick and Simple Utility for JavaScript",
|
|
5
5
|
"author": "Jooy2 <jooy2.contact@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -57,18 +57,18 @@
|
|
|
57
57
|
],
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/mocha": "^10.0.1",
|
|
60
|
-
"@types/node": "^18.11.
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
62
|
-
"@typescript-eslint/parser": "^5.
|
|
60
|
+
"@types/node": "^18.11.19",
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "^5.51.0",
|
|
62
|
+
"@typescript-eslint/parser": "^5.51.0",
|
|
63
63
|
"date-fns": "^2.29.3",
|
|
64
|
-
"eslint": "^8.
|
|
64
|
+
"eslint": "^8.33.0",
|
|
65
65
|
"eslint-config-airbnb": "^19.0.4",
|
|
66
|
-
"eslint-config-prettier": "^8.
|
|
67
|
-
"eslint-plugin-import": "^2.
|
|
66
|
+
"eslint-config-prettier": "^8.6.0",
|
|
67
|
+
"eslint-plugin-import": "^2.27.5",
|
|
68
68
|
"mocha": "^10.2.0",
|
|
69
|
-
"prettier": "^2.8.
|
|
70
|
-
"terser": "^5.16.
|
|
69
|
+
"prettier": "^2.8.3",
|
|
70
|
+
"terser": "^5.16.3",
|
|
71
71
|
"ts-node": "^10.9.1",
|
|
72
|
-
"typescript": "^4.9.
|
|
72
|
+
"typescript": "^4.9.5"
|
|
73
73
|
}
|
|
74
74
|
}
|