qsu 1.14.0 → 1.16.0

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.
Files changed (71) hide show
  1. package/dist/_types/global.d.ts +9 -0
  2. package/dist/array/_comparableKey.d.ts +9 -0
  3. package/dist/array/_comparableKey.js +1 -0
  4. package/dist/array/arrCompact.d.ts +1 -0
  5. package/dist/array/arrCompact.js +1 -0
  6. package/dist/array/arrDifference.d.ts +1 -0
  7. package/dist/array/arrDifference.js +1 -0
  8. package/dist/array/arrIntersection.d.ts +1 -0
  9. package/dist/array/arrIntersection.js +1 -0
  10. package/dist/array/index.d.ts +3 -0
  11. package/dist/array/index.js +1 -1
  12. package/dist/misc/index.d.ts +2 -0
  13. package/dist/misc/index.js +1 -1
  14. package/dist/misc/retry.d.ts +2 -0
  15. package/dist/misc/retry.js +1 -0
  16. package/dist/misc/throttle.d.ts +2 -0
  17. package/dist/misc/throttle.js +1 -0
  18. package/dist/node/crypto/decrypt.js +1 -1
  19. package/dist/node/crypto/encrypt.js +1 -1
  20. package/dist/node/crypto/md5Hash.js +1 -1
  21. package/dist/node/crypto/sha1Hash.js +1 -1
  22. package/dist/node/crypto/sha256Hash.js +1 -1
  23. package/dist/node/crypto/sha512Hash.js +1 -1
  24. package/dist/node/file/createDirectory.js +1 -1
  25. package/dist/node/file/createFile.js +1 -1
  26. package/dist/node/file/createFileWithDummy.js +1 -1
  27. package/dist/node/file/deleteAllFileFromDirectory.js +1 -1
  28. package/dist/node/file/deleteFile.js +1 -1
  29. package/dist/node/file/getCopyFileName.d.ts +1 -1
  30. package/dist/node/file/getCopyFileName.js +1 -1
  31. package/dist/node/file/getFileExtension.js +1 -1
  32. package/dist/node/file/getFileHashFromPath.js +1 -1
  33. package/dist/node/file/getFileHashFromStream.js +1 -1
  34. package/dist/node/file/getFileInfo.js +1 -1
  35. package/dist/node/file/getFileName.js +1 -1
  36. package/dist/node/file/getFilePathLevel.js +1 -1
  37. package/dist/node/file/getFileSize.js +1 -1
  38. package/dist/node/file/getParentFilePath.js +1 -1
  39. package/dist/node/file/headFile.js +1 -1
  40. package/dist/node/file/isFileExists.js +1 -1
  41. package/dist/node/file/isFileHidden.js +1 -1
  42. package/dist/node/file/isValidFileName.js +1 -1
  43. package/dist/node/file/joinFilePath.js +1 -1
  44. package/dist/node/file/moveFile.js +1 -1
  45. package/dist/node/file/tailFile.js +1 -1
  46. package/dist/node/file/toValidFilePath.js +1 -1
  47. package/dist/node/os/getCpu.js +1 -1
  48. package/dist/node/os/getHostname.js +1 -1
  49. package/dist/node/os/getMachineId.js +1 -1
  50. package/dist/node/os/getSid.js +1 -1
  51. package/dist/node/os/runCommand.js +1 -1
  52. package/dist/object/index.d.ts +3 -0
  53. package/dist/object/index.js +1 -1
  54. package/dist/object/objInvert.d.ts +4 -0
  55. package/dist/object/objInvert.js +1 -0
  56. package/dist/object/objMapKeys.d.ts +2 -0
  57. package/dist/object/objMapKeys.js +1 -0
  58. package/dist/object/objPickBy.d.ts +2 -0
  59. package/dist/object/objPickBy.js +1 -0
  60. package/dist/string/deburr.d.ts +1 -0
  61. package/dist/string/deburr.js +1 -0
  62. package/dist/string/escapeRegExp.d.ts +1 -0
  63. package/dist/string/escapeRegExp.js +1 -0
  64. package/dist/string/index.d.ts +4 -0
  65. package/dist/string/index.js +1 -1
  66. package/dist/string/uncapitalizeFirst.d.ts +1 -0
  67. package/dist/string/uncapitalizeFirst.js +1 -0
  68. package/dist/string/words.d.ts +1 -0
  69. package/dist/string/words.js +1 -0
  70. package/dist/verify/hasBadWords.js +1 -1
  71. package/package.json +5 -5
@@ -15,6 +15,15 @@ export type DurationOptions = {
15
15
  maxUnitCount?: number;
16
16
  unit?: DurationUnitName;
17
17
  };
18
+ export type RetryOptions = {
19
+ times?: number;
20
+ delay?: number;
21
+ backoff?: number;
22
+ };
23
+ export type ThrottleOptions = {
24
+ leading?: boolean;
25
+ trailing?: boolean;
26
+ };
18
27
  export interface FileInfo {
19
28
  success: boolean;
20
29
  isDirectory: boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * (Private, not exported from the package) A stable string key for a value, so that array
3
+ * membership can be decided by value instead of by reference.
4
+ *
5
+ * Python cannot hash a list or a dict at all, so a reference comparison could not have been
6
+ * ported to all three languages. Comparing by value also means `arrDifference([[1]], [[1]])`
7
+ * answers the same way everywhere.
8
+ */
9
+ export declare function comparableKey(value: any): string;
@@ -0,0 +1 @@
1
+ export function comparableKey(n){if(null===n)return"null";if(void 0===n)return"undefined";const r=typeof n;if("number"===r)return Number.isNaN(n)?"number:NaN":`number:${0===n?0:n}`;if("string"===r||"boolean"===r||"bigint"===r)return`${r}:${n}`;if("function"===r||"symbol"===r)return`${r}:${String(n)}`;try{return`json:${JSON.stringify(n)}`}catch{return`json:${String(n)}`}}
@@ -0,0 +1 @@
1
+ export declare function arrCompact(array: any[]): any[];
@@ -0,0 +1 @@
1
+ export function arrCompact(r){if(!Array.isArray(r))return[];const t=[];for(let n=0,e=r.length;n<e;n+=1){const e=r[n];null==e||!1===e||0===e||""===e||"number"==typeof e&&Number.isNaN(e)||t.push(e)}return t}
@@ -0,0 +1 @@
1
+ export declare function arrDifference(array: any[], ...others: any[][]): any[];
@@ -0,0 +1 @@
1
+ import{comparableKey as r}from"./_comparableKey.js";export function arrDifference(e,...t){if(!Array.isArray(e))return[];const n=new Set;for(let e=0,a=t.length;e<a;e+=1){const a=t[e];if(Array.isArray(a))for(let e=0,t=a.length;e<t;e+=1)n.add(r(a[e]))}return e.filter(e=>!n.has(r(e)))}
@@ -0,0 +1 @@
1
+ export declare function arrIntersection(...arrays: any[][]): any[];
@@ -0,0 +1 @@
1
+ import{comparableKey as r}from"./_comparableKey.js";export function arrIntersection(...e){if(e.length<1||!Array.isArray(e[0]))return[];const[t,...n]=e,a=[];for(let e=0,t=n.length;e<t;e+=1){if(!Array.isArray(n[e]))return[];a.push(new Set(n[e].map(r)))}const o=new Set,s=[];for(let e=0,n=t.length;e<n;e+=1){const n=t[e],h=r(n);o.has(h)||(o.add(h),a.every(r=>r.has(h))&&s.push(n))}return s}
@@ -1,5 +1,8 @@
1
+ export { arrCompact } from './arrCompact.js';
1
2
  export { arrCount } from './arrCount.js';
3
+ export { arrDifference } from './arrDifference.js';
2
4
  export { arrGroupByMaxCount } from './arrGroupByMaxCount.js';
5
+ export { arrIntersection } from './arrIntersection.js';
3
6
  export { arrMove } from './arrMove.js';
4
7
  export { arrPick } from './arrPick.js';
5
8
  export { arrRepeat } from './arrRepeat.js';
@@ -1 +1 @@
1
- export{arrCount}from"./arrCount.js";export{arrGroupByMaxCount}from"./arrGroupByMaxCount.js";export{arrMove}from"./arrMove.js";export{arrPick}from"./arrPick.js";export{arrRepeat}from"./arrRepeat.js";export{arrShuffle}from"./arrShuffle.js";export{arrTo1dArray}from"./arrTo1dArray.js";export{arrUnique}from"./arrUnique.js";export{arrWithDefault}from"./arrWithDefault.js";export{arrWithNumber}from"./arrWithNumber.js";export{average}from"./average.js";export{sortByObjectKey}from"./sortByObjectKey.js";export{sortNumeric}from"./sortNumeric.js";
1
+ export{arrCompact}from"./arrCompact.js";export{arrCount}from"./arrCount.js";export{arrDifference}from"./arrDifference.js";export{arrGroupByMaxCount}from"./arrGroupByMaxCount.js";export{arrIntersection}from"./arrIntersection.js";export{arrMove}from"./arrMove.js";export{arrPick}from"./arrPick.js";export{arrRepeat}from"./arrRepeat.js";export{arrShuffle}from"./arrShuffle.js";export{arrTo1dArray}from"./arrTo1dArray.js";export{arrUnique}from"./arrUnique.js";export{arrWithDefault}from"./arrWithDefault.js";export{arrWithNumber}from"./arrWithNumber.js";export{average}from"./average.js";export{sortByObjectKey}from"./sortByObjectKey.js";export{sortNumeric}from"./sortNumeric.js";
@@ -1,3 +1,5 @@
1
1
  export { debounce } from './debounce.js';
2
2
  export { funcTimes } from './funcTimes.js';
3
+ export { retry } from './retry.js';
3
4
  export { sleep } from './sleep.js';
5
+ export { throttle } from './throttle.js';
@@ -1 +1 @@
1
- export{debounce}from"./debounce.js";export{funcTimes}from"./funcTimes.js";export{sleep}from"./sleep.js";
1
+ export{debounce}from"./debounce.js";export{funcTimes}from"./funcTimes.js";export{retry}from"./retry.js";export{sleep}from"./sleep.js";export{throttle}from"./throttle.js";
@@ -0,0 +1,2 @@
1
+ import type { RetryOptions } from '../_types/global';
2
+ export declare function retry<T>(func: () => T | Promise<T>, options?: RetryOptions): Promise<T>;
@@ -0,0 +1 @@
1
+ import{sleep as t}from"./sleep.js";export async function retry(r,e){const a=e?.times??3,o=e?.delay??0,s=e?.backoff??1;if(a<1)throw new Error("`times` must be at least 1.");let i,c=o;for(let e=1;e<=a;e+=1)try{return await r()}catch(r){i=r,e<a&&(c>0&&await t(c),c*=s)}throw i}
@@ -0,0 +1,2 @@
1
+ import type { PositiveNumber, ThrottleOptions } from '../_types/global';
2
+ export declare function throttle<N extends number>(func: (...args: any[]) => void, wait: PositiveNumber<N>, options?: ThrottleOptions): (...args: any[]) => void;
@@ -0,0 +1 @@
1
+ export function throttle(n,l,t){const o=t?.leading??!0,e=t?.trailing??!0;let u,i=null,r=null;const c=()=>{i=o?Date.now():null,u=void 0;const l=r;r=null,l&&n(...l)};return(...t)=>{const s=Date.now();null!==i||o||(i=s);const a=null===i?0:l-(s-i);if(r=t,a<=0||a>l)return u&&(clearTimeout(u),u=void 0),i=s,r=null,void n(...t);!u&&e&&(u=setTimeout(c,a),u?.unref?.())}}
@@ -1 +1 @@
1
- import{createDecipheriv as t}from"crypto";import{AEAD_ALGORITHM as r}from"./encrypt.js";export function decrypt(e,n,f="aes-256-cbc",o=!1){if(!e||e.length<1)return"";const i=o?"base64":"hex",u=e.split(":"),c=r.test(f);if(u.length<(c?3:2))throw new Error(c?"`str` must be in the `iv:authTag:encrypted` format returned by `encrypt`.":"`str` must be in the `iv:encrypted` format returned by `encrypt`.");const s=Buffer.from(u.shift(),i),p=c?Buffer.from(u.shift(),i):null,m=t(f,n,s);p&&m.setAuthTag(p);let a=m.update(Buffer.from(u.join(":"),i));return a=Buffer.concat([a,m.final()]),a.toString()}
1
+ import{createDecipheriv as t}from"node:crypto";import{AEAD_ALGORITHM as r}from"./encrypt.js";export function decrypt(e,n,f="aes-256-cbc",o=!1){if(!e||e.length<1)return"";const i=o?"base64":"hex",u=e.split(":"),c=r.test(f);if(u.length<(c?3:2))throw new Error(c?"`str` must be in the `iv:authTag:encrypted` format returned by `encrypt`.":"`str` must be in the `iv:encrypted` format returned by `encrypt`.");const s=Buffer.from(u.shift(),i),p=c?Buffer.from(u.shift(),i):null,m=t(f,n,s);p&&m.setAuthTag(p);let a=m.update(Buffer.from(u.join(":"),i));return a=Buffer.concat([a,m.final()]),a.toString()}
@@ -1 +1 @@
1
- import{createCipheriv as t,randomBytes as n}from"crypto";export const AEAD_ALGORITHM=/gcm|ccm|ocb|poly1305/i;export function encrypt(o,r,c="aes-256-cbc",e=16,i=!1){if(!o||o.length<1)return"";const g=n(e),f=t(c,r,g);let p=f.update(o);p=Buffer.concat([p,f.final()]);const s=i?"base64":"hex";if(AEAD_ALGORITHM.test(c)){const t=f.getAuthTag();return`${g.toString(s)}:${t.toString(s)}:${p.toString(s)}`}return`${g.toString(s)}:${p.toString(s)}`}
1
+ import{createCipheriv as t,randomBytes as n}from"node:crypto";export const AEAD_ALGORITHM=/gcm|ccm|ocb|poly1305/i;export function encrypt(o,r,e="aes-256-cbc",c=16,i=!1){if(!o||o.length<1)return"";const g=n(c),f=t(e,r,g);let p=f.update(o);p=Buffer.concat([p,f.final()]);const s=i?"base64":"hex";if(AEAD_ALGORITHM.test(e)){const t=f.getAuthTag();return`${g.toString(s)}:${t.toString(s)}:${p.toString(s)}`}return`${g.toString(s)}:${p.toString(s)}`}
@@ -1 +1 @@
1
- import{createHash as t}from"crypto";export function md5Hash(r,e){return t("md5").update(r).digest(e??"hex")}
1
+ import{createHash as t}from"node:crypto";export function md5Hash(e,o){return t("md5").update(e).digest(o??"hex")}
@@ -1 +1 @@
1
- import{createHash as t}from"crypto";export function sha1Hash(r,e){return t("sha1").update(r).digest(e??"hex")}
1
+ import{createHash as t}from"node:crypto";export function sha1Hash(e,o){return t("sha1").update(e).digest(o??"hex")}
@@ -1 +1 @@
1
- import{createHash as t}from"crypto";export function sha256Hash(r,e){return t("sha256").update(r).digest(e??"hex")}
1
+ import{createHash as t}from"node:crypto";export function sha256Hash(e,o){return t("sha256").update(e).digest(o??"hex")}
@@ -1 +1 @@
1
- import{createHash as t}from"crypto";export function sha512Hash(r,e){return t("sha512").update(r).digest(e??"hex")}
1
+ import{createHash as t}from"node:crypto";export function sha512Hash(e,o){return t("sha512").update(e).digest(o??"hex")}
@@ -1 +1 @@
1
- import{mkdir as r}from"fs/promises";import{isFileExists as i}from"./isFileExists.js";export async function createDirectory(t,e=!0){try{await i(t)||await r(t,{recursive:e})}catch(r){if(r instanceof Error)throw new Error(r.message)}}
1
+ import{mkdir as r,stat as i}from"node:fs/promises";export async function createDirectory(t,e=!0){if(e)await r(t,{recursive:!0});else try{await r(t)}catch(r){if("EEXIST"!==r?.code)throw r;if(!(await i(t)).isDirectory())throw r}}
@@ -1 +1 @@
1
- import{open as t,utimes as a}from"fs/promises";export async function createFile(e){if(!e)return;const c=new Date;try{await a(e,c,c)}catch{const a=await t(e,"a");await a.close()}}
1
+ import{mkdir as t,open as a,utimes as e}from"node:fs/promises";import{dirname as r}from"node:path";export async function createFile(i){if(!i?.trim())return;const o=new Date;try{await e(i,o,o)}catch{await t(r(i),{recursive:!0});const e=await a(i,"a");await e.close()}}
@@ -1 +1 @@
1
- import{open as r}from"fs/promises";import{createFile as e}from"./createFile.js";export async function createFileWithDummy(t,i){if(null==i)throw new Error("Size is required");if(i<0)throw new Error("Size must be 0 or greater");try{if(0===i)return await e(t),!0;const o=await r(t,"w");return await o.write(Buffer.alloc(1),0,1,i-1),await o.close(),!0}catch{return!1}}
1
+ import{open as r}from"node:fs/promises";import{createFile as e}from"./createFile.js";export async function createFileWithDummy(t,i){if(null==i)throw new Error("Size is required");if(i<0)throw new Error("Size must be 0 or greater");try{if(0===i)return await e(t),!0;const o=await r(t,"w");return await o.write(Buffer.alloc(1),0,1,i-1),await o.close(),!0}catch{return!1}}
@@ -1 +1 @@
1
- import{readdir as t}from"fs/promises";import{join as e}from"path";import{deleteFile as o}from"./deleteFile.js";export async function deleteAllFileFromDirectory(r){let i=[];try{i=await t(r)}catch{}const l=i.length;for(let t=0;t<l;t+=1)await o(e(r,i[t]))}
1
+ import{readdir as e}from"node:fs/promises";import{join as t}from"node:path";import{deleteFile as o}from"./deleteFile.js";export async function deleteAllFileFromDirectory(r){let i=[];try{i=await e(r)}catch{}const l=i.length;for(let e=0;e<l;e+=32)await Promise.all(i.slice(e,e+32).map(e=>o(t(r,e))))}
@@ -1 +1 @@
1
- import{rm as e}from"fs/promises";export async function deleteFile(r){if(r)try{await e(r,{recursive:!0,force:!0})}catch{}}
1
+ import{rm as e}from"node:fs/promises";export async function deleteFile(r){if(r?.trim())try{await e(r,{recursive:!0,force:!0})}catch{}}
@@ -1 +1 @@
1
- export declare function getCopyFileName(fileName: string, fileNameList: string[]): string;
1
+ export declare function getCopyFileName(fileName: string, fileNameList: string[] | Set<string>): string;
@@ -1 +1 @@
1
- import{getFileName as e}from"./getFileName.js";export function getCopyFileName(t,n){const o=e(t),r=e(t,!0).slice(o.length),i=new Set(n);if(!i.has(t))return t;for(let e=1;;e++){const t=`${o} (${e})${r}`;if(!i.has(t))return t}}
1
+ import{getFileName as e}from"./getFileName.js";export function getCopyFileName(t,n){const o=e(t),i=e(t,!0).slice(o.length),r=n instanceof Set?n:new Set(n);if(!r.has(t))return t;for(let e=1;;e++){const t=`${o} (${e})${i}`;if(!r.has(t))return t}}
@@ -1 +1 @@
1
- import{extname as e}from"path";import{getFileName as t}from"./getFileName.js";export function getFileExtension(o){const r=e(t(o,!0)).replace(".","").toLowerCase();return r?.length>0?r:null}
1
+ import{extname as e}from"node:path";import{getFileName as t}from"./getFileName.js";export function getFileExtension(o){const n=e(t(o,!0)).replace(".","").toLowerCase();return n?.length>0?n:null}
@@ -1 +1 @@
1
- import{createHash as r}from"crypto";import{createReadStream as o}from"fs";export async function getFileHashFromPath(t,e="md5"){return new Promise((n,i)=>{if(!t)return void i(new Error("Invalid path"));const a=r(e),d=o(t);d.on("error",r=>{i(r)}),d.on("data",r=>{a.update(r)}),d.on("end",()=>{n(a.digest("hex"))})})}
1
+ import{createHash as r}from"node:crypto";import{createReadStream as o}from"node:fs";import{pipeline as t}from"node:stream/promises";export async function getFileHashFromPath(e,i="md5"){if(!e)throw new Error("Invalid path");const a=r(i);return await t(o(e,{highWaterMark:1048576}),a),a.digest("hex")}
@@ -1 +1 @@
1
- import{createHash as r}from"crypto";import{pipeline as t}from"stream/promises";export async function getFileHashFromStream(e,o="md5"){if(!e)throw new Error("Invalid file stream detected");const i=r(o);return await t(e,i),i.digest("hex")}
1
+ import{createHash as e}from"node:crypto";import{pipeline as r}from"node:stream/promises";export async function getFileHashFromStream(t,o="md5"){if(!t)throw new Error("Invalid file stream detected");const i=e(o);return await r(t,i),i.digest("hex")}
@@ -1 +1 @@
1
- import{stat as e}from"fs/promises";import{dirname as i,resolve as r}from"path";import{getFileExtension as t}from"./getFileExtension.js";import{fileSizeFormat as o}from"../../format/fileSizeFormat.js";import{getFileName as s}from"./getFileName.js";export async function getFileInfo(m){const n=e=>Math.floor(new Date(e).getTime()/1e3);try{const a=await e(m);return{success:!0,isDirectory:a.isDirectory(),ext:t(m),size:a.size,sizeHumanized:o(a.size),name:s(m),dirname:i(m),path:r(m),created:n(a.ctime),modified:n(a.mtime)}}catch(e){if(e instanceof Error)throw new Error(e.message)}return{success:!1,isDirectory:!1,ext:null,size:0,sizeHumanized:"0 Bytes",name:"unknown",dirname:i(m),path:m,created:-1,modified:-1}}
1
+ import{stat as e}from"node:fs/promises";import{dirname as i,resolve as t}from"node:path";import{getFileExtension as o}from"./getFileExtension.js";import{fileSizeFormat as r}from"../../format/fileSizeFormat.js";import{getFileName as m}from"./getFileName.js";export async function getFileInfo(s){const a=e=>Math.floor(new Date(e).getTime()/1e3),n=await e(s);return{success:!0,isDirectory:n.isDirectory(),ext:o(s),size:n.size,sizeHumanized:r(n.size),name:m(s),dirname:i(s),path:t(s),created:a(n.ctime),modified:a(n.mtime)}}
@@ -1 +1 @@
1
- import{posix as e,win32 as n}from"path";export function getFileName(t,i=!1){const a=!i&&!t.endsWith("/")&&!t.endsWith("\\");return-1===t.indexOf("/")&&-1!==t.indexOf("\\")?n.basename(t,a?n.extname(t):void 0)||"":e.basename(t,a?e.extname(t):void 0)||""}
1
+ import{posix as e,win32 as n}from"node:path";export function getFileName(t,i=!1){const a=!i&&!t.endsWith("/")&&!t.endsWith("\\");return-1===t.indexOf("/")&&-1!==t.indexOf("\\")?n.basename(t,a?n.extname(t):void 0)||"":e.basename(t,a?e.extname(t):void 0)||""}
@@ -1 +1 @@
1
- import{posix as t}from"path";import{toPosixFilePath as e}from"./toPosixFilePath.js";export function getFilePathLevel(o){return o?"/"===o?1:e(o.replace(/[\\/]+$/,"")).split(t.sep).length:-1}
1
+ import{posix as e}from"node:path";import{toPosixFilePath as t}from"./toPosixFilePath.js";export function getFilePathLevel(o){return o?"/"===o?1:t(o.replace(/[\\/]+$/,"")).split(e.sep).length:-1}
@@ -1 +1 @@
1
- import{stat as r}from"fs/promises";export async function getFileSize(e){try{return(await r(e)).size}catch(r){if(r instanceof Error)throw new Error(r.message)}return-1}
1
+ import{stat as e}from"node:fs/promises";export async function getFileSize(i){return(await e(i)).size}
@@ -1 +1 @@
1
- import{toValidFilePath as t}from"./toValidFilePath.js";import{posix as r,win32 as e}from"path";export function getParentFilePath(i,a){return t(a?e.dirname(i):r.dirname(i),a)}
1
+ import{toValidFilePath as t}from"./toValidFilePath.js";import{posix as r,win32 as e}from"node:path";export function getParentFilePath(i,o){return t(o?e.dirname(i):r.dirname(i),o)}
@@ -1 +1 @@
1
- import{createReadStream as n}from"fs";import{createInterface as o}from"node:readline";export async function headFile(e,r=1){return r<=0?null:new Promise((l,t)=>{const i=n(e,{encoding:"utf-8"}),s=o({input:i,crlfDelay:1/0}),c=[];s.on("line",n=>{c.push(n),c.length>=r&&(s.close(),i.destroy())}),s.on("close",()=>{0===c.length?l(null):l(c.join("\n"))}),s.on("error",n=>t(n)),i.on("error",n=>t(n))})}
1
+ import{createReadStream as n}from"node:fs";import{createInterface as o}from"node:readline";export async function headFile(e,r=1){return r<=0?null:new Promise((l,t)=>{const i=n(e,{encoding:"utf-8"}),s=o({input:i,crlfDelay:1/0}),c=[];s.on("line",n=>{c.push(n),c.length>=r&&(s.close(),i.destroy())}),s.on("close",()=>{0===c.length?l(null):l(c.join("\n"))}),s.on("error",n=>t(n)),i.on("error",n=>t(n))})}
@@ -1 +1 @@
1
- import{stat as r}from"fs/promises";export async function isFileExists(t){try{return await r(t),!0}catch{return!1}}
1
+ import{stat as r}from"node:fs/promises";export async function isFileExists(t){try{return await r(t),!0}catch{return!1}}
@@ -1 +1 @@
1
- import{exec as e}from"child_process";export function isFileHidden(i,r=!1){return new Promise(t=>{r?e(`attrib "${i}"`,(e,r,o)=>{t(!(e||o||!r)&&r.replace(i,"").includes("H"))}):t(/(^|\/)\.[^/.]/.test(i.split("/")?.pop()||"/"))})}
1
+ import{execFile as i}from"node:child_process";const t=/^(.*?)\s+(?:[A-Za-z]:\\|\\\\)/;export function isFileHidden(e,n=!1){return new Promise(r=>{n?i("attrib",[e],(i,e,n)=>{if(i||n||!e)return void r(!1);const o=e.split(/\r?\n/).find(i=>i.trim().length>0)||"",s=t.exec(o);r(!!s&&s[1].includes("H"))}):r(/(^|\/)\.[^/.]/.test(e.split("/")?.pop()||"/"))})}
@@ -1 +1 @@
1
- import{getFileName as t}from"./getFileName.js";const e=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i;export function isValidFileName(i,n){let s;const l=t(i,!0);if(n)s=/(^\s+$)|(^\.+$)|([:/]+)/;else if(s=/(^\s+$)|(^\.+$)|([<>:"/\\|?*]+)/,e.test(l.split(".")[0]))return!1;return!s.test(l)&&l.length<=255}
1
+ import{getFileName as t}from"./getFileName.js";const e=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i,n=/[\u0000-\u001F\u007F]/;export function isValidFileName(r,i){let s;const u=t(r,!0);if(u.length<1||n.test(u))return!1;if(i)s=/(^\s+$)|(^\.+$)|([:/]+)/;else{if(s=/(^\s+$)|(^\.+$)|([<>:"/\\|?*]+)/,e.test(u.split(".")[0]))return!1;if(/[. ]$/.test(u))return!1}return!s.test(u)&&Buffer.byteLength(u,"utf8")<=255}
@@ -1 +1 @@
1
- import{posix as o,win32 as i}from"path";import{toValidFilePath as t}from"./toValidFilePath.js";export function joinFilePath(r,...n){return t(r?i.join(...n):o.join(...n),r)}
1
+ import{posix as o,win32 as i}from"node:path";import{toValidFilePath as t}from"./toValidFilePath.js";export function joinFilePath(n,...r){return t(n?i.join(...r):o.join(...r),n)}
@@ -1 +1 @@
1
- import{rename as o}from"fs/promises";export async function moveFile(i,e){i&&e&&await o(i,e)}
1
+ import{copyFile as i,mkdir as t,readdir as a,rename as r,rm as o,stat as e}from"node:fs/promises";import{join as c}from"node:path";async function n(r,o){if(!(await e(r)).isDirectory())return void await i(r,o);await t(o,{recursive:!0});const f=await a(r);for(let i=0,t=f.length;i<t;i+=1)await n(c(r,f[i]),c(o,f[i]))}export async function moveFile(i,t){if(i?.trim()&&t?.trim())try{await r(i,t)}catch(a){if("EXDEV"!==a?.code)throw a;await n(i,t),await o(i,{recursive:!0,force:!0})}}
@@ -1 +1 @@
1
- import{createReadStream as n}from"fs";import{createInterface as o}from"node:readline";export async function tailFile(e,l=1){return l<=0?null:new Promise((r,t)=>{const i=n(e,{encoding:"utf-8"}),u=o({input:i,crlfDelay:1/0}),f=[];u.on("line",n=>{f.length===l&&f.shift(),f.push(n)}),u.on("close",()=>{0!==f.length?(""===f[f.length-1]&&f.pop(),0!==f.length?r(f.join("\n")):r(null)):r(null)}),u.on("error",n=>t(n)),i.on("error",n=>t(n))})}
1
+ import{open as t}from"node:fs/promises";const n=/\r\n|\n|\r/;function o(t){const o=t.split(n);return o.length>1&&""===o[o.length-1]&&o.pop(),o}export async function tailFile(n,e=1){if(e<=0)return null;const l=await t(n,"r");try{const{size:t}=await l.stat();if(0===t)return null;const n=[];let r=t,i=[];for(;r>0;){const t=Math.min(65536,r);r-=t;const s=Buffer.alloc(t);if(await l.read(s,0,t,r),n.unshift(s),i=o(Buffer.concat(n).toString("utf-8")),i.length>e)break}const s=i.slice(-e);return s.length>0&&""===s[s.length-1]&&s.pop(),0===s.length?null:s.join("\n")}finally{await l.close()}}
@@ -1 +1 @@
1
- import{posix as e,win32 as t}from"path";export function toValidFilePath(i,n){if(i?.length<1)return n?"\\":"/";if(n){let e=i;return e=t.normalize(e).replace(/\.$/g,""),e.endsWith("\\")&&e.length>1&&(e=e.replace(/\\+$/,"")),e.endsWith(":")&&(e=`${e}\\`),e.startsWith("\\")||-1!==e.indexOf(":")||(e=`\\${e}`),e}{let t=i;return t=e.normalize(t),"."===t?"/":(e.isAbsolute(t)||(t=`/${t}`),t.endsWith("/")&&t.length>1&&(t=t.slice(0,-1)),t)}}
1
+ import{posix as e,win32 as t}from"node:path";export function toValidFilePath(i,n){if(i?.length<1)return n?"\\":"/";if(n){let e=i;return e=t.normalize(e).replace(/\.$/g,""),e.startsWith("\\")||-1!==e.indexOf(":")||(e=t.normalize(`\\${e}`)),e.endsWith("\\")&&e.length>1&&(e=e.replace(/\\+$/,"")),e.endsWith(":")&&(e=`${e}\\`),e}{let t=i;return t=e.normalize(t),"."===t?"/":(e.isAbsolute(t)||(t=e.normalize(`/${t}`)),t.endsWith("/")&&t.length>1&&(t=t.slice(0,-1)),t)}}
@@ -1 +1 @@
1
- import{cpus as o}from"os";export function getCpu(){return`${o()?.[0]?.model||"Unknown"}`}
1
+ import{cpus as o}from"node:os";export function getCpu(){return`${o()?.[0]?.model||"Unknown"}`}
@@ -1 +1 @@
1
- import{hostname as n,platform as r}from"os";import{runCommand as t}from"./runCommand.js";export async function getHostname(){const e=r();let o;if("win32"===e)return process.env.COMPUTERNAME||n()||"Unknown";if("darwin"===e)o="scutil --get ComputerName";else{if("linux"!==e&&"freebsd"!==e)return n()||"Unknown";o="hostnamectl hostname"}try{const n=await t(o);if(n)return n}catch(n){if(n instanceof Error)throw new Error(n?.message)}return"Unknown"}
1
+ import{hostname as n,platform as r}from"node:os";import{runCommand as e}from"./runCommand.js";export async function getHostname(){const t=r();let o;if("win32"===t)return process.env.COMPUTERNAME||n()||"Unknown";if("darwin"===t)o="scutil --get ComputerName";else{if("linux"!==t&&"freebsd"!==t)return n()||"Unknown";o="hostnamectl hostname"}try{const n=await e(o);if(n)return n}catch(n){if(n instanceof Error)throw new Error(n?.message)}return"Unknown"}
@@ -1 +1 @@
1
- import{platform as r}from"os";import{runCommand as e}from"./runCommand.js";export async function getMachineId(){const i=r();let t;t="win32"===i?"for /f \"tokens=3 delims= \" %i in ('REG QUERY HKLM\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid ^| findstr MachineGuid') do @echo %i":"darwin"===i?"ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/' | cut -d '\"' -f4":"freebsd"===i?"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid":"(cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname) | head -n 1 || :";try{const r=await e(t);if(r)return r}catch(r){if(r instanceof Error)throw new Error(r?.message)}throw new Error("Failed to get machine id")}
1
+ import{platform as e}from"node:os";import{runCommand as r}from"./runCommand.js";export async function getMachineId(){const i=e();let o;o="win32"===i?"for /f \"tokens=3 delims= \" %i in ('REG QUERY HKLM\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid ^| findstr MachineGuid') do @echo %i":"darwin"===i?"ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/' | cut -d '\"' -f4":"freebsd"===i?"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid":"(cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname) | head -n 1 || :";try{const e=await r(o);if(e)return e}catch(e){if(e instanceof Error)throw new Error(e?.message)}throw new Error("Failed to get machine id")}
@@ -1 +1 @@
1
- import{homedir as r,platform as t,userInfo as o}from"os";import{runCommand as e}from"./runCommand.js";export async function getSid(){const n=t();if("win32"===n){try{const t=await e('REG QUERY "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList" /s');if(!t)throw new Error("Failed to get machine id");const o={};t.split("HKEY_LOCAL_MACHINE\\").forEach(r=>{const t=r.split("\n").map(r=>r.trim()).filter(r=>r);if(t.length>0){const r=t[0].split("\\").pop()||"Unknown",e=t.find(r=>r.startsWith("ProfileImagePath"));e&&(o[r]=e.split(" ").pop()||"Unknown")}});for(let t=0;t<Object.keys(o).length;t+=1){const e=Object.keys(o)[t];if(o[e]===r())return e}}catch(r){if(r instanceof Error)throw new Error(r?.message)}throw new Error("Failed to get machine id")}if("darwin"===n){try{const r=await e(`dsmemberutil getsid -U ${o().username}`);if(r)return r.replace(/\r?\n/g,"")}catch(r){if(r instanceof Error)throw new Error(r?.message)}throw new Error("Failed to get machine id")}throw new Error("Not supported on this operating system.")}
1
+ import{homedir as r,platform as t,userInfo as o}from"node:os";import{runCommand as e}from"./runCommand.js";export async function getSid(){const n=t();if("win32"===n){try{const t=await e('REG QUERY "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList" /s');if(!t)throw new Error("Failed to get machine id");const o={};t.split("HKEY_LOCAL_MACHINE\\").forEach(r=>{const t=r.split("\n").map(r=>r.trim()).filter(r=>r);if(t.length>0){const r=t[0].split("\\").pop()||"Unknown",e=t.find(r=>r.startsWith("ProfileImagePath"));e&&(o[r]=e.split(" ").pop()||"Unknown")}});for(let t=0;t<Object.keys(o).length;t+=1){const e=Object.keys(o)[t];if(o[e]===r())return e}}catch(r){if(r instanceof Error)throw new Error(r?.message)}throw new Error("Failed to get machine id")}if("darwin"===n){try{const r=await e(`dsmemberutil getsid -U ${o().username}`);if(r)return r.replace(/\r?\n/g,"")}catch(r){if(r instanceof Error)throw new Error(r?.message)}throw new Error("Failed to get machine id")}throw new Error("Not supported on this operating system.")}
@@ -1 +1 @@
1
- import{exec as e}from"child_process";import{EOL as n}from"os";export function runCommand(o){return new Promise((r,i)=>{const s=e(o,{encoding:"utf8",windowsHide:!0},(e,o)=>{e?i(e):(s?.stdin?.end(),r(o.replace(new RegExp(`${n}$`),"")))})})}
1
+ import{exec as e}from"node:child_process";import{EOL as n}from"node:os";export function runCommand(o){return new Promise((r,d)=>{const i=e(o,{encoding:"utf8",windowsHide:!0},(e,o)=>{e?d(e):(i?.stdin?.end(),r(o.replace(new RegExp(`${n}$`),"")))})})}
@@ -1,6 +1,9 @@
1
1
  export { objDeleteKeyByValue } from './objDeleteKeyByValue.js';
2
2
  export { objFindItemRecursiveByKey } from './objFindItemRecursiveByKey.js';
3
+ export { objInvert } from './objInvert.js';
4
+ export { objMapKeys } from './objMapKeys.js';
3
5
  export { objMergeNewKey } from './objMergeNewKey.js';
6
+ export { objPickBy } from './objPickBy.js';
4
7
  export { objTo1d } from './objTo1d.js';
5
8
  export { objToArray } from './objToArray.js';
6
9
  export { objToPrettyStr } from './objToPrettyStr.js';
@@ -1 +1 @@
1
- export{objDeleteKeyByValue}from"./objDeleteKeyByValue.js";export{objFindItemRecursiveByKey}from"./objFindItemRecursiveByKey.js";export{objMergeNewKey}from"./objMergeNewKey.js";export{objTo1d}from"./objTo1d.js";export{objToArray}from"./objToArray.js";export{objToPrettyStr}from"./objToPrettyStr.js";export{objToQueryString}from"./objToQueryString.js";export{objUpdate}from"./objUpdate.js";
1
+ export{objDeleteKeyByValue}from"./objDeleteKeyByValue.js";export{objFindItemRecursiveByKey}from"./objFindItemRecursiveByKey.js";export{objInvert}from"./objInvert.js";export{objMapKeys}from"./objMapKeys.js";export{objMergeNewKey}from"./objMergeNewKey.js";export{objPickBy}from"./objPickBy.js";export{objTo1d}from"./objTo1d.js";export{objToArray}from"./objToArray.js";export{objToPrettyStr}from"./objToPrettyStr.js";export{objToQueryString}from"./objToQueryString.js";export{objUpdate}from"./objUpdate.js";
@@ -0,0 +1,4 @@
1
+ import type { AnyValueObject } from '../_types/global';
2
+ export declare function objInvert(obj: AnyValueObject): {
3
+ [key: string]: string;
4
+ } | null;
@@ -0,0 +1 @@
1
+ export function objInvert(t){if(!t||"object"!=typeof t)return null;const e={},n=Object.keys(t);for(let o=0,r=n.length;o<r;o+=1){const r=n[o];e[String(t[r])]=r}return e}
@@ -0,0 +1,2 @@
1
+ import type { AnyValueObject } from '../_types/global';
2
+ export declare function objMapKeys(obj: AnyValueObject, iteratee: (value: any, key: string) => string): AnyValueObject | null;
@@ -0,0 +1 @@
1
+ export function objMapKeys(t,e){if(!t||"object"!=typeof t)return null;const n={},o=Object.keys(t);for(let r=0,c=o.length;r<c;r+=1){const c=o[r];n[e(t[c],c)]=t[c]}return n}
@@ -0,0 +1,2 @@
1
+ import type { AnyValueObject } from '../_types/global';
2
+ export declare function objPickBy(obj: AnyValueObject, predicate: (value: any, key: string) => boolean): AnyValueObject | null;
@@ -0,0 +1 @@
1
+ export function objPickBy(t,e){if(!t||"object"!=typeof t)return null;const n={},o=Object.keys(t);for(let c=0,r=o.length;c<r;c+=1){const r=o[c];e(t[r],r)&&(n[r]=t[r])}return n}
@@ -0,0 +1 @@
1
+ export declare function deburr(str: string): string;
@@ -0,0 +1 @@
1
+ const t=[["ÀÁÂÃÄÅĀĂĄ","A"],["àáâãäåāăą","a"],["ÇĆĈĊČ","C"],["çćĉċč","c"],["ÐĎĐ","D"],["ðďđ","d"],["ÈÉÊËĒĔĖĘĚ","E"],["èéêëēĕėęě","e"],["ĜĞĠĢ","G"],["ĝğġģ","g"],["ĤĦ","H"],["ĥħ","h"],["ÌÍÎÏĨĪĬĮİ","I"],["ìíîïĩīĭįı","i"],["Ĵ","J"],["ĵ","j"],["Ķ","K"],["ķĸ","k"],["ĹĻĽĿŁ","L"],["ĺļľŀł","l"],["ÑŃŅŇŊ","N"],["ñńņňŋ","n"],["ÒÓÔÕÖØŌŎŐ","O"],["òóôõöøōŏő","o"],["ŔŖŘ","R"],["ŕŗř","r"],["ŚŜŞŠ","S"],["śŝşšſ","s"],["ŢŤŦ","T"],["ţťŧ","t"],["ÙÚÛÜŨŪŬŮŰŲ","U"],["ùúûüũūŭůűų","u"],["Ŵ","W"],["ŵ","w"],["ÝŶŸ","Y"],["ýÿŷ","y"],["ŹŻŽ","Z"],["źżž","z"],["Æ","Ae"],["æ","ae"],["Þ","Th"],["þ","th"],["ß","ss"],["IJ","IJ"],["ij","ij"],["Œ","Oe"],["œ","oe"],["ʼn","'n"]],e=new Map;for(let n=0,r=t.length;n<r;n+=1){const[s,c]=t[n];for(const f of s)e.set(f,c)}const o=t=>t>=768&&t<=879||t>=8400&&t<=8432||t>=65056&&t<=65071;export function deburr(t){if(!t)return"";let n="";for(const r of t)o(r.codePointAt(0))||(n+=e.get(r)??r);return n}
@@ -0,0 +1 @@
1
+ export declare function escapeRegExp(str: string): string;
@@ -0,0 +1 @@
1
+ const e=/[\\^$.*+?()[\]{}|]/g;export function escapeRegExp(c){return c?c.replace(e,"\\$&"):""}
@@ -1,6 +1,8 @@
1
1
  export { capitalizeEachWords } from './capitalizeEachWords.js';
2
2
  export { capitalizeEverySentence } from './capitalizeEverySentence.js';
3
3
  export { capitalizeFirst } from './capitalizeFirst.js';
4
+ export { deburr } from './deburr.js';
5
+ export { escapeRegExp } from './escapeRegExp.js';
4
6
  export { getGroupKeys } from './getGroupKeys.js';
5
7
  export { getStrBytes } from './getStrBytes.js';
6
8
  export { removeNewLine } from './removeNewLine.js';
@@ -16,4 +18,6 @@ export { strUnique } from './strUnique.js';
16
18
  export { trim } from './trim.js';
17
19
  export { truncate } from './truncate.js';
18
20
  export { truncateExpect } from './truncateExpect.js';
21
+ export { uncapitalizeFirst } from './uncapitalizeFirst.js';
19
22
  export { urlJoin } from './urlJoin.js';
23
+ export { words } from './words.js';
@@ -1 +1 @@
1
- export{capitalizeEachWords}from"./capitalizeEachWords.js";export{capitalizeEverySentence}from"./capitalizeEverySentence.js";export{capitalizeFirst}from"./capitalizeFirst.js";export{getGroupKeys}from"./getGroupKeys.js";export{getStrBytes}from"./getStrBytes.js";export{removeNewLine}from"./removeNewLine.js";export{removeSpecialChar}from"./removeSpecialChar.js";export{replaceBetween}from"./replaceBetween.js";export{split}from"./split.js";export{strBlindRandom}from"./strBlindRandom.js";export{strCount}from"./strCount.js";export{strRandom}from"./strRandom.js";export{strShuffle}from"./strShuffle.js";export{strToAscii}from"./strToAscii.js";export{strUnique}from"./strUnique.js";export{trim}from"./trim.js";export{truncate}from"./truncate.js";export{truncateExpect}from"./truncateExpect.js";export{urlJoin}from"./urlJoin.js";
1
+ export{capitalizeEachWords}from"./capitalizeEachWords.js";export{capitalizeEverySentence}from"./capitalizeEverySentence.js";export{capitalizeFirst}from"./capitalizeFirst.js";export{deburr}from"./deburr.js";export{escapeRegExp}from"./escapeRegExp.js";export{getGroupKeys}from"./getGroupKeys.js";export{getStrBytes}from"./getStrBytes.js";export{removeNewLine}from"./removeNewLine.js";export{removeSpecialChar}from"./removeSpecialChar.js";export{replaceBetween}from"./replaceBetween.js";export{split}from"./split.js";export{strBlindRandom}from"./strBlindRandom.js";export{strCount}from"./strCount.js";export{strRandom}from"./strRandom.js";export{strShuffle}from"./strShuffle.js";export{strToAscii}from"./strToAscii.js";export{strUnique}from"./strUnique.js";export{trim}from"./trim.js";export{truncate}from"./truncate.js";export{truncateExpect}from"./truncateExpect.js";export{uncapitalizeFirst}from"./uncapitalizeFirst.js";export{urlJoin}from"./urlJoin.js";export{words}from"./words.js";
@@ -0,0 +1 @@
1
+ export declare function uncapitalizeFirst(str: string): string;
@@ -0,0 +1 @@
1
+ export function uncapitalizeFirst(t){return t?t.charAt(0).toLowerCase()+t.slice(1):""}
@@ -0,0 +1 @@
1
+ export declare function words(str: string): string[];
@@ -0,0 +1 @@
1
+ const e=/\p{L}/u,t=/\p{M}/u,s=/\p{Lu}|\p{Lt}/u,o=/\p{Ll}/u,r=e=>e>="0"&&e<="9",f=t=>e.test(t),i=e=>t.test(e),l=e=>s.test(e),n=e=>o.test(e),u=e=>l(e)||n(e);export function words(e){if(!e)return[];const t=Array.from(e),s=t.length,o=[];let p=0;for(;p<s;){const e=t[p];let c=p+1;if(r(e)){for(;c<s&&r(t[c]);)c+=1;o.push(t.slice(p,c).join("")),p=c}else if(f(e)){if(u(e))if(l(e)){for(;c<s&&f(t[c])&&l(t[c]);)c+=1;if(c-p>1)c<s&&f(t[c])&&n(t[c])&&(c-=1);else for(;c<s&&(i(t[c])||f(t[c])&&n(t[c]));)c+=1}else for(;c<s&&(i(t[c])||f(t[c])&&n(t[c]));)c+=1;else for(;c<s&&(i(t[c])||f(t[c])&&!u(t[c]));)c+=1;o.push(t.slice(p,c).join("")),p=c}else p+=1}return o}
@@ -1 +1 @@
1
- const o="ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎ",t="ㅏㅐㅑㅒㅓㅔㅕㅖㅗㅘㅙㅚㅛㅜㅝㅞㅟㅠㅡㅢㅣ",n=" ㄱㄲㄳㄴㄵㄶㄷㄹㄺㄻㄼㄽㄾㄿㅀㅁㅂㅄㅅㅆㅇㅈㅊㅋㅌㅍㅎ",e={"ㅗㅏ":"ㅘ","ㅗㅐ":"ㅙ","ㅗㅣ":"ㅚ","ㅜㅓ":"ㅝ","ㅜㅔ":"ㅞ","ㅜㅣ":"ㅟ","ㅡㅣ":"ㅢ"},r={"ㄱㅅ":"ㄳ","ㄴㅈ":"ㄵ","ㄴㅎ":"ㄶ","ㄹㄱ":"ㄺ","ㄹㅁ":"ㄻ","ㄹㅂ":"ㄼ","ㄹㅅ":"ㄽ","ㄹㅌ":"ㄾ","ㄹㅍ":"ㄿ","ㄹㅎ":"ㅀ","ㅂㅅ":"ㅄ"},f={r:"ㅏ",i:"ㅣ"},s=o=>{const t={};for(const n of o)for(const o of n.slice(1))t[o]=n[0];return t},i=[9398,119808,119860,119912,120224,120276,120328,120380,120432],c=o=>{for(const t of i)if(o>=t&&o<=t+51)return String.fromCharCode(97+(o-t)%26)},l=s(["a4àáâãäåāăąаα","b8вβ","cçćčс","dďđ","e3èéêëēĕėęěеёε","g69ğ","hн","i1lìíîïīįıłіι","jј","kкκ","mм","nñńň","o0òóôõöøōőоο","pрρ","s5śšşѕ","t7ţťтτ","uùúûüūůűų","xхχ","yýÿу","z2źżž"]),d=s(["a@","c¢(","e€£","i!|¡/","s$§","t+","o°"]),h=/[\p{L}\p{N}]/u,u=o=>void 0!==o&&(t.includes(o)||void 0!==f[o]),g=(s,i)=>{const g=[];for(const e of s.toLowerCase()){let r=e;const f=r.codePointAt(0);f>=65281&&f<=65374?r=String.fromCharCode(f-65248).toLowerCase():f>=4352&&f<=4370?r=o[f-4352]:f>=4449&&f<=4469?r=t[f-4449]:f>=4520&&f<=4546?r=n[f-4519]:f>=9398&&(r=c(f)??r),void 0!==l[r]?g.push(l[r]):h.test(r)?g.push(r):i&&void 0!==d[r]&&g.push(d[r])}for(let o=1,t=g.length;o<t;o+=1)"ㅇ"===g[o]&&g[o-1]>="a"&&g[o-1]<="z"&&(g[o]="o");return(s=>{const i=[],c=s.length;let l=0;for(;l<c;){const d=o.indexOf(s[l]);let h=l+1,g=h<c?t.indexOf(f[s[h]]??s[h]):-1;if(-1===d||-1===g){i.push(s[l]),l+=1;continue}h+=1;const p=h<c?e[t[g]+s[h]]:void 0;void 0!==p&&(g=t.indexOf(p),h+=1);let a=h<c&&!u(s[h+1])?Math.max(n.indexOf(s[h]),0):0;if(a>0){h+=1;const o=h<c?r[n[a]+s[h]]:void 0;void 0===o||u(s[h+1])||(a=n.indexOf(o),h+=1)}i.push(String.fromCharCode(44032+28*(21*d+g)+a)),l=h}return i.join("")})(g).replace(/ㅇ/g,"o")},p=(o,t,n,e)=>{for(let r=0,f=n.length;r<f;r+=1)if(o>=n[r]&&o<e[r])return o===n[r]||o+t<=e[r];return!1},a=o=>{const t=[];for(const n of o){if("string"!=typeof n)continue;const o=g(n,!0);o&&t.push(o)}return t};export function hasBadWords(o,t=[],n=[]){if(!o||!t||0===t.length)return!1;const e=a(t);if(0===e.length)return!1;const r=n?a(n):[],f=o.split(/\s+/).filter(o=>""!==o);for(const o of[!0,!1]){const t=[],n=[];let s="";for(const e of f){const r=g(e,o);r&&(t.push(s.length),s+=r,n.push(s.length))}for(const o of r){let t=s.indexOf(o);for(;-1!==t;)s=s.slice(0,t)+"\0".repeat(o.length)+s.slice(t+o.length),t=s.indexOf(o,t+o.length)}for(const o of e){let e=s.indexOf(o);for(;-1!==e;){if(p(e,o.length,t,n))return!0;e=s.indexOf(o,e+1)}}}return!1}
1
+ const o="ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎ",t="ㅏㅐㅑㅒㅓㅔㅕㅖㅗㅘㅙㅚㅛㅜㅝㅞㅟㅠㅡㅢㅣ",n=" ㄱㄲㄳㄴㄵㄶㄷㄹㄺㄻㄼㄽㄾㄿㅀㅁㅂㅄㅅㅆㅇㅈㅊㅋㅌㅍㅎ",e={"ㅗㅏ":"ㅘ","ㅗㅐ":"ㅙ","ㅗㅣ":"ㅚ","ㅜㅓ":"ㅝ","ㅜㅔ":"ㅞ","ㅜㅣ":"ㅟ","ㅡㅣ":"ㅢ"},r={"ㄱㅅ":"ㄳ","ㄴㅈ":"ㄵ","ㄴㅎ":"ㄶ","ㄹㄱ":"ㄺ","ㄹㅁ":"ㄻ","ㄹㅂ":"ㄼ","ㄹㅅ":"ㄽ","ㄹㅌ":"ㄾ","ㄹㅍ":"ㄿ","ㄹㅎ":"ㅀ","ㅂㅅ":"ㅄ"},s={r:"ㅏ",i:"ㅣ"},f=o=>{const t={};for(const n of o)for(const o of n.slice(1))t[o]=n[0];return t},i=[9398,119808,119860,119912,120224,120276,120328,120380,120432],c=o=>{for(const t of i)if(o>=t&&o<=t+51)return String.fromCharCode(97+(o-t)%26)},l=f(["a4àáâãäåāăąаα","b8вβ","cçćčс","dďđ","e3èéêëēĕėęěеёε","g69ğ","hн","i1lìíîïīįıłіι","jј","kкκ","mм","nñńň","o0òóôõöøōőоο","pрρ","s5śšşѕ","t7ţťтτ","uùúûüūůűų","xхχ","yýÿу","z2źżž"]),u=f(["a@","c¢(","e€£","i!|¡/","s$§","t+","o°"]),h=/[\p{L}\p{N}]/u,d=o=>void 0!==o&&(t.includes(o)||void 0!==s[o]),p=(f,i,p)=>{const g=[],a=[];for(const e of f.toLowerCase()){let r=e;const s=r.codePointAt(0);s>=65281&&s<=65374?r=String.fromCharCode(s-65248).toLowerCase():s>=4352&&s<=4370?r=o[s-4352]:s>=4449&&s<=4469?r=t[s-4449]:s>=4520&&s<=4546?r=n[s-4519]:s>=9398&&(r=c(s)??r);const f=r>="0"&&r<="9";void 0!==l[r]?(g.push(l[r]),a.push(f)):h.test(r)?(g.push(r),a.push(f)):i&&void 0!==u[r]&&(g.push(u[r]),a.push(!1))}const x=p?((o,t)=>{const n=[],e=o.length;let r=0;for(;r<e;){if(!t[r]){n.push(o[r]),r+=1;continue}let s=r;for(;s<e&&t[s];)s+=1;if(0===r||s===e)for(let t=r;t<s;t+=1)n.push(o[t]);r=s}return n})(g,a):g;for(let o=1,t=x.length;o<t;o+=1)"ㅇ"===x[o]&&x[o-1]>="a"&&x[o-1]<="z"&&(x[o]="o");return(f=>{const i=[],c=f.length;let l=0;for(;l<c;){const u=o.indexOf(f[l]);let h=l+1,p=h<c?t.indexOf(s[f[h]]??f[h]):-1;if(-1===u||-1===p){i.push(f[l]),l+=1;continue}h+=1;const g=h<c?e[t[p]+f[h]]:void 0;void 0!==g&&(p=t.indexOf(g),h+=1);let a=h<c&&!d(f[h+1])?Math.max(n.indexOf(f[h]),0):0;if(a>0){h+=1;const o=h<c?r[n[a]+f[h]]:void 0;void 0===o||d(f[h+1])||(a=n.indexOf(o),h+=1)}i.push(String.fromCharCode(44032+28*(21*u+p)+a)),l=h}return i.join("")})(x).replace(/ㅇ/g,"o")},g=(o,t,n,e)=>{for(let r=0,s=n.length;r<s;r+=1)if(o>=n[r]&&o<e[r])return o===n[r]||o+t<=e[r];return!1},a=[[!0,!1],[!1,!1],[!0,!0],[!1,!0]],x=o=>{const t=[];for(const n of o){if("string"!=typeof n)continue;const o=p(n,!0,!1);o&&t.push(o)}return t};export function hasBadWords(o,t=[],n=[]){if(!o||!t||0===t.length)return!1;const e=x(t);if(0===e.length)return!1;const r=n?x(n):[],s=o.split(/\s+/).filter(o=>""!==o);for(const[o,t]of a){const n=[],f=[];let i="";for(const e of s){const r=p(e,o,t);r&&(n.push(i.length),i+=r,f.push(i.length))}for(const o of r){let t=i.indexOf(o);for(;-1!==t;)i=i.slice(0,t)+"\0".repeat(o.length)+i.slice(t+o.length),t=i.indexOf(o,t+o.length)}for(const o of e){let t=i.indexOf(o);for(;-1!==t;){if(g(t,o.length,n,f))return!0;t=i.indexOf(o,t+1)}}}return!1}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qsu",
3
- "version": "1.14.0",
3
+ "version": "1.16.0",
4
4
  "description": "qsu is a utility library that contains useful and frequently used functions. Start with your preferred language and the modern development environment.",
5
5
  "author": "CDGet <jooy2.contact@gmail.com>",
6
6
  "license": "MIT",
@@ -74,17 +74,17 @@
74
74
  "devDependencies": {
75
75
  "@eslint/js": "^9.39.2",
76
76
  "@types/node": "^26.1.2",
77
- "@typescript-eslint/parser": "^8.65.0",
77
+ "@typescript-eslint/parser": "^8.66.0",
78
78
  "dayjs": "^1.11.21",
79
79
  "eslint": "^9.39.2",
80
80
  "eslint-config-prettier": "^10.1.8",
81
81
  "eslint-plugin-n": "^18.2.2",
82
- "globals": "^17.8.0",
82
+ "globals": "^17.9.0",
83
83
  "jiti": "^2.7.0",
84
84
  "prettier": "^3.9.6",
85
85
  "terser-glob": "^1.2.1",
86
- "tsx": "^4.23.1",
86
+ "tsx": "^4.23.5",
87
87
  "typescript": "6.0.3",
88
- "typescript-eslint": "^8.65.0"
88
+ "typescript-eslint": "^8.66.0"
89
89
  }
90
90
  }