qsu 1.1.7 → 1.1.8
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/README.md +23 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/package.json +11 -11
- package/tsconfig.prod.json +4 -0
package/README.md
CHANGED
|
@@ -433,6 +433,19 @@ _.truncate('hello', 3); // Returns 'hel'
|
|
|
433
433
|
_.truncate('hello', 2, '...'); // Returns 'he...'
|
|
434
434
|
```
|
|
435
435
|
|
|
436
|
+
### `_.truncateExpect (string)`
|
|
437
|
+
|
|
438
|
+
The string ignores truncation until the ending character (`endStringChar`). If the expected length is reached, return the truncated string until after the ending character.
|
|
439
|
+
|
|
440
|
+
- `str::string`
|
|
441
|
+
- `expectLength::number`
|
|
442
|
+
- `endStringChar::string || '.'`
|
|
443
|
+
|
|
444
|
+
```javascript
|
|
445
|
+
_.truncateExpect('hello. this is test string.', 10, '.'); // Returns 'hello. this is test string.'
|
|
446
|
+
_.truncateExpect('hello-this-is-test-string-bye', 14, '-'); // Returns 'hello-this-is-'
|
|
447
|
+
```
|
|
448
|
+
|
|
436
449
|
### `_.split (string[])`
|
|
437
450
|
|
|
438
451
|
Splits a string based on the specified character and returns it as an Array. Unlike the existing split, it splits the values provided as multiple parameters (array or multiple arguments) at once.
|
|
@@ -532,6 +545,16 @@ Remove duplicate characters from a given string and output only one.
|
|
|
532
545
|
_.strUnique('aaabbbcc'); // Returns 'abc'
|
|
533
546
|
```
|
|
534
547
|
|
|
548
|
+
### `_.strToAscii (number[])`
|
|
549
|
+
|
|
550
|
+
Converts the given string to ascii code and returns it as an array.
|
|
551
|
+
|
|
552
|
+
- `str::string`
|
|
553
|
+
|
|
554
|
+
```javascript
|
|
555
|
+
_.strToAscii('12345'); // Returns [49, 50, 51, 52, 53]
|
|
556
|
+
```
|
|
557
|
+
|
|
535
558
|
### `_.isObject (boolean)`
|
|
536
559
|
|
|
537
560
|
Check whether the given data is of type `Object`. Returns `false` for other data types including `Array`.
|
package/dist/index.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export default class Qsu {
|
|
|
47
47
|
static strRandom<N extends number>(length: PositiveNumber<N>, additionalCharacters?: string): string;
|
|
48
48
|
static strBlindRandom<N extends number>(str: string, blindLength: PositiveNumber<N>, blindStr?: string): string;
|
|
49
49
|
static truncate<N extends number>(str: string, length: PositiveNumber<N>, ellipsis?: string): string;
|
|
50
|
+
static truncateExpect<N extends number>(str: string, expectLength: PositiveNumber<N>, endStringChar?: string): string;
|
|
50
51
|
static split(str: string, ...splitter: any[]): string[];
|
|
51
52
|
static split(str: string, ...splitter: Array<string>): string[];
|
|
52
53
|
static encrypt(str: string, secret: string, algorithm?: string, ivSize?: number): string;
|
|
@@ -56,6 +57,7 @@ export default class Qsu {
|
|
|
56
57
|
static sha256(str: string): string;
|
|
57
58
|
static encodeBase64(str: string): string;
|
|
58
59
|
static decodeBase64(encodedStr: string): string;
|
|
60
|
+
static strToAscii(str: string): number[];
|
|
59
61
|
static strUnique(str: string): string;
|
|
60
62
|
static isObject(data: any): boolean;
|
|
61
63
|
static isEqual(leftOperand: any, ...rightOperand: Array<any>): boolean;
|
|
@@ -77,4 +79,4 @@ export default class Qsu {
|
|
|
77
79
|
static license(options: LicenseOption): string;
|
|
78
80
|
}
|
|
79
81
|
export { Qsu };
|
|
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;
|
|
82
|
+
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, truncateExpect: typeof Qsu.truncateExpect, 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, strToAscii: typeof Qsu.strToAscii, 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 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;
|
|
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 truncateExpect(t,e,r="."){if(!t)return"";let a="";const o=t.split(r);let n=0;for(;a.length<e;)a+=`${o[n]}${r}`,n+=1;return 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 strToAscii(t){const e=[];for(let r=0;r<t.length;r+=1)e.push(t.charCodeAt(r));return e}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,truncateExpect:truncateExpect,split:split,encrypt:encrypt,decrypt:decrypt,md5:md5,sha1:sha1,sha256:sha256,encodeBase64:encodeBase64,decodeBase64:decodeBase64,strUnique:strUnique,strToAscii:strToAscii,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.8",
|
|
4
4
|
"description": "Quick and Simple Utility for JavaScript",
|
|
5
5
|
"author": "Jooy2 <jooy2.contact@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "npm run format:fix && tsc && npm run minify",
|
|
18
|
+
"build": "npm run format:fix && tsc --project tsconfig.prod.json && npm run minify",
|
|
19
19
|
"test": "npm run build && mocha test/**/*.spec.ts -r ts-node/register --loader=ts-node/esm --timeout 10000",
|
|
20
20
|
"lint": "eslint .",
|
|
21
21
|
"lint:fix": "eslint --fix .",
|
|
@@ -57,18 +57,18 @@
|
|
|
57
57
|
],
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/mocha": "^10.0.1",
|
|
60
|
-
"@types/node": "^
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
62
|
-
"@typescript-eslint/parser": "^5.
|
|
63
|
-
"date-fns": "^2.
|
|
64
|
-
"eslint": "^8.
|
|
60
|
+
"@types/node": "^20.1.3",
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "^5.59.5",
|
|
62
|
+
"@typescript-eslint/parser": "^5.59.5",
|
|
63
|
+
"date-fns": "^2.30.0",
|
|
64
|
+
"eslint": "^8.40.0",
|
|
65
65
|
"eslint-config-airbnb": "^19.0.4",
|
|
66
|
-
"eslint-config-prettier": "^8.
|
|
66
|
+
"eslint-config-prettier": "^8.8.0",
|
|
67
67
|
"eslint-plugin-import": "^2.27.5",
|
|
68
68
|
"mocha": "^10.2.0",
|
|
69
|
-
"prettier": "^2.8.
|
|
70
|
-
"terser": "^5.
|
|
69
|
+
"prettier": "^2.8.8",
|
|
70
|
+
"terser": "^5.17.3",
|
|
71
71
|
"ts-node": "^10.9.1",
|
|
72
|
-
"typescript": "^
|
|
72
|
+
"typescript": "^5.0.3"
|
|
73
73
|
}
|
|
74
74
|
}
|