qsu 1.6.4 → 1.7.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 (249) hide show
  1. package/README.md +0 -7
  2. package/dist/_types/global.d.ts +33 -0
  3. package/dist/array/arrCount.d.ts +2 -0
  4. package/dist/array/arrCount.js +1 -0
  5. package/dist/array/arrGroupByMaxCount.d.ts +1 -0
  6. package/dist/array/arrGroupByMaxCount.js +1 -0
  7. package/dist/array/arrMove.d.ts +2 -0
  8. package/dist/array/arrMove.js +1 -0
  9. package/dist/array/arrRepeat.d.ts +2 -0
  10. package/dist/array/arrRepeat.js +1 -0
  11. package/dist/array/arrShuffle.d.ts +1 -0
  12. package/dist/array/arrShuffle.js +1 -0
  13. package/dist/array/arrTo1dArray.d.ts +1 -0
  14. package/dist/array/arrTo1dArray.js +1 -0
  15. package/dist/array/arrUnique.d.ts +1 -0
  16. package/dist/array/arrUnique.js +1 -0
  17. package/dist/array/arrWithDefault.d.ts +1 -0
  18. package/dist/array/arrWithDefault.js +1 -0
  19. package/dist/array/arrWithNumber.d.ts +1 -0
  20. package/dist/array/arrWithNumber.js +1 -0
  21. package/dist/array/average.d.ts +1 -0
  22. package/dist/array/average.js +1 -0
  23. package/dist/array/index.d.ts +12 -0
  24. package/dist/array/index.js +1 -0
  25. package/dist/array/sortByObjectKey.d.ts +1 -0
  26. package/dist/array/sortByObjectKey.js +1 -0
  27. package/dist/array/sortNumeric.d.ts +1 -0
  28. package/dist/array/sortNumeric.js +1 -0
  29. package/dist/date/createDateListFromRange.d.ts +1 -0
  30. package/dist/date/createDateListFromRange.js +1 -0
  31. package/dist/date/dateToYYYYMMDD.d.ts +1 -0
  32. package/dist/date/dateToYYYYMMDD.js +1 -0
  33. package/dist/date/dayDiff.d.ts +1 -0
  34. package/dist/date/dayDiff.js +1 -0
  35. package/dist/date/index.d.ts +5 -0
  36. package/dist/date/index.js +1 -0
  37. package/dist/date/isValidDate.d.ts +1 -0
  38. package/dist/date/isValidDate.js +1 -0
  39. package/dist/date/today.d.ts +1 -0
  40. package/dist/date/today.js +1 -0
  41. package/dist/encrypt/decodeBase64.d.ts +1 -0
  42. package/dist/encrypt/decodeBase64.js +1 -0
  43. package/dist/encrypt/decrypt.d.ts +1 -0
  44. package/dist/encrypt/decrypt.js +1 -0
  45. package/dist/encrypt/encodeBase64.d.ts +1 -0
  46. package/dist/encrypt/encodeBase64.js +1 -0
  47. package/dist/encrypt/encrypt.d.ts +1 -0
  48. package/dist/encrypt/encrypt.js +1 -0
  49. package/dist/encrypt/index.d.ts +9 -0
  50. package/dist/encrypt/index.js +1 -0
  51. package/dist/encrypt/md5Hash.d.ts +1 -0
  52. package/dist/encrypt/md5Hash.js +1 -0
  53. package/dist/encrypt/objectId.d.ts +1 -0
  54. package/dist/encrypt/objectId.js +1 -0
  55. package/dist/encrypt/sha1Hash.d.ts +1 -0
  56. package/dist/encrypt/sha1Hash.js +1 -0
  57. package/dist/encrypt/sha256Hash.d.ts +1 -0
  58. package/dist/encrypt/sha256Hash.js +1 -0
  59. package/dist/encrypt/strToNumberHash.d.ts +1 -0
  60. package/dist/encrypt/strToNumberHash.js +1 -0
  61. package/dist/file/createDirectory.d.ts +1 -0
  62. package/dist/file/createDirectory.js +1 -0
  63. package/dist/file/createFile.d.ts +1 -0
  64. package/dist/file/createFile.js +1 -0
  65. package/dist/file/createFileWithDummy.d.ts +1 -0
  66. package/dist/file/createFileWithDummy.js +1 -0
  67. package/dist/file/deleteAllFileFromDirectory.d.ts +1 -0
  68. package/dist/file/deleteAllFileFromDirectory.js +1 -0
  69. package/dist/file/deleteFile.d.ts +1 -0
  70. package/dist/file/deleteFile.js +1 -0
  71. package/dist/file/getFileExtension.d.ts +1 -0
  72. package/dist/file/getFileExtension.js +1 -0
  73. package/dist/file/getFileHash.d.ts +1 -0
  74. package/dist/file/getFileHash.js +1 -0
  75. package/dist/file/getFileInfo.d.ts +2 -0
  76. package/dist/file/getFileInfo.js +1 -0
  77. package/dist/file/getFileName.d.ts +1 -0
  78. package/dist/file/getFileName.js +1 -0
  79. package/dist/file/getFilePathLevel.d.ts +1 -0
  80. package/dist/file/getFilePathLevel.js +1 -0
  81. package/dist/file/getFileSize.d.ts +2 -0
  82. package/dist/file/getFileSize.js +1 -0
  83. package/dist/file/getParentFilePath.d.ts +1 -0
  84. package/dist/file/getParentFilePath.js +1 -0
  85. package/dist/file/headFile.d.ts +1 -0
  86. package/dist/file/headFile.js +1 -0
  87. package/dist/file/index.d.ts +22 -0
  88. package/dist/file/index.js +1 -0
  89. package/dist/file/isFileExists.d.ts +1 -0
  90. package/dist/file/isFileExists.js +1 -0
  91. package/dist/file/isFileHidden.d.ts +1 -0
  92. package/dist/file/isFileHidden.js +1 -0
  93. package/dist/file/isValidFileName.d.ts +1 -0
  94. package/dist/file/isValidFileName.js +1 -0
  95. package/dist/file/joinFilePath.d.ts +1 -0
  96. package/dist/file/joinFilePath.js +1 -0
  97. package/dist/file/moveFile.d.ts +1 -0
  98. package/dist/file/moveFile.js +1 -0
  99. package/dist/file/normalizeFile.d.ts +1 -0
  100. package/dist/file/normalizeFile.js +1 -0
  101. package/dist/file/tailFile.d.ts +1 -0
  102. package/dist/file/tailFile.js +1 -0
  103. package/dist/file/toPosixFilePath.d.ts +1 -0
  104. package/dist/file/toPosixFilePath.js +1 -0
  105. package/dist/file/toValidFilePath.d.ts +1 -0
  106. package/dist/file/toValidFilePath.js +1 -0
  107. package/dist/format/duration.d.ts +2 -0
  108. package/dist/format/duration.js +1 -0
  109. package/dist/format/index.d.ts +4 -0
  110. package/dist/format/index.js +1 -0
  111. package/dist/format/numberFormat.d.ts +1 -0
  112. package/dist/format/numberFormat.js +1 -0
  113. package/dist/format/safeJSONParse.d.ts +2 -0
  114. package/dist/format/safeJSONParse.js +1 -0
  115. package/dist/format/safeParseInt.d.ts +1 -0
  116. package/dist/format/safeParseInt.js +1 -0
  117. package/dist/index.d.ts +11 -9
  118. package/dist/index.js +1 -1
  119. package/dist/math/div.d.ts +2 -0
  120. package/dist/math/div.js +1 -0
  121. package/dist/math/index.d.ts +5 -0
  122. package/dist/math/index.js +1 -0
  123. package/dist/math/mul.d.ts +2 -0
  124. package/dist/math/mul.js +1 -0
  125. package/dist/math/numRandom.d.ts +1 -0
  126. package/dist/math/numRandom.js +1 -0
  127. package/dist/math/sub.d.ts +2 -0
  128. package/dist/math/sub.js +1 -0
  129. package/dist/math/sum.d.ts +2 -0
  130. package/dist/math/sum.js +1 -0
  131. package/dist/misc/debounce.d.ts +2 -0
  132. package/dist/misc/debounce.js +1 -0
  133. package/dist/misc/funcTimes.d.ts +2 -0
  134. package/dist/misc/funcTimes.js +1 -0
  135. package/dist/misc/index.d.ts +3 -0
  136. package/dist/misc/index.js +1 -0
  137. package/dist/misc/sleep.d.ts +2 -0
  138. package/dist/misc/sleep.js +1 -0
  139. package/dist/object/index.d.ts +8 -0
  140. package/dist/object/index.js +1 -0
  141. package/dist/object/objDeleteKeyByValue.d.ts +2 -0
  142. package/dist/object/objDeleteKeyByValue.js +1 -0
  143. package/dist/object/objFindItemRecursiveByKey.d.ts +2 -0
  144. package/dist/object/objFindItemRecursiveByKey.js +1 -0
  145. package/dist/object/objMergeNewKey.d.ts +4 -0
  146. package/dist/object/objMergeNewKey.js +1 -0
  147. package/dist/object/objTo1d.d.ts +2 -0
  148. package/dist/object/objTo1d.js +1 -0
  149. package/dist/object/objToArray.d.ts +2 -0
  150. package/dist/object/objToArray.js +1 -0
  151. package/dist/object/objToPrettyStr.d.ts +2 -0
  152. package/dist/object/objToPrettyStr.js +1 -0
  153. package/dist/object/objToQueryString.d.ts +2 -0
  154. package/dist/object/objToQueryString.js +1 -0
  155. package/dist/object/objUpdate.d.ts +2 -0
  156. package/dist/object/objUpdate.js +1 -0
  157. package/dist/string/capitalizeEachWords.d.ts +1 -0
  158. package/dist/string/capitalizeEachWords.js +1 -0
  159. package/dist/string/capitalizeEverySentence.d.ts +1 -0
  160. package/dist/string/capitalizeEverySentence.js +1 -0
  161. package/dist/string/capitalizeFirst.d.ts +1 -0
  162. package/dist/string/capitalizeFirst.js +1 -0
  163. package/dist/string/index.d.ts +17 -0
  164. package/dist/string/index.js +1 -0
  165. package/dist/string/removeNewLine.d.ts +1 -0
  166. package/dist/string/removeNewLine.js +1 -0
  167. package/dist/string/removeSpecialChar.d.ts +1 -0
  168. package/dist/string/removeSpecialChar.js +1 -0
  169. package/dist/string/replaceBetween.d.ts +1 -0
  170. package/dist/string/replaceBetween.js +1 -0
  171. package/dist/string/split.d.ts +2 -0
  172. package/dist/string/split.js +1 -0
  173. package/dist/string/strBlindRandom.d.ts +2 -0
  174. package/dist/string/strBlindRandom.js +1 -0
  175. package/dist/string/strCount.d.ts +1 -0
  176. package/dist/string/strCount.js +1 -0
  177. package/dist/string/strRandom.d.ts +2 -0
  178. package/dist/string/strRandom.js +1 -0
  179. package/dist/string/strShuffle.d.ts +1 -0
  180. package/dist/string/strShuffle.js +1 -0
  181. package/dist/string/strToAscii.d.ts +1 -0
  182. package/dist/string/strToAscii.js +1 -0
  183. package/dist/string/strUnique.d.ts +1 -0
  184. package/dist/string/strUnique.js +1 -0
  185. package/dist/string/trim.d.ts +1 -0
  186. package/dist/string/trim.js +1 -0
  187. package/dist/string/truncate.d.ts +2 -0
  188. package/dist/string/truncate.js +1 -0
  189. package/dist/string/truncateExpect.d.ts +2 -0
  190. package/dist/string/truncateExpect.js +1 -0
  191. package/dist/string/urlJoin.d.ts +1 -0
  192. package/dist/string/urlJoin.js +1 -0
  193. package/dist/verify/between.d.ts +1 -0
  194. package/dist/verify/between.js +1 -0
  195. package/dist/verify/contains.d.ts +1 -0
  196. package/dist/verify/contains.js +1 -0
  197. package/dist/verify/index.d.ts +11 -0
  198. package/dist/verify/index.js +1 -0
  199. package/dist/verify/is2dArray.d.ts +1 -0
  200. package/dist/verify/is2dArray.js +1 -0
  201. package/dist/verify/isEmail.d.ts +1 -0
  202. package/dist/verify/isEmail.js +1 -0
  203. package/dist/verify/isEmpty.d.ts +1 -0
  204. package/dist/verify/isEmpty.js +1 -0
  205. package/dist/verify/isEqual.d.ts +1 -0
  206. package/dist/verify/isEqual.js +1 -0
  207. package/dist/verify/isEqualStrict.d.ts +1 -0
  208. package/dist/verify/isEqualStrict.js +1 -0
  209. package/dist/verify/isObject.d.ts +1 -0
  210. package/dist/verify/isObject.js +1 -0
  211. package/dist/verify/isTrueMinimumNumberOfTimes.d.ts +1 -0
  212. package/dist/verify/isTrueMinimumNumberOfTimes.js +1 -0
  213. package/dist/verify/isUrl.d.ts +1 -0
  214. package/dist/verify/isUrl.js +1 -0
  215. package/dist/verify/len.d.ts +1 -0
  216. package/dist/verify/len.js +1 -0
  217. package/dist/web/generateLicense.d.ts +2 -0
  218. package/dist/web/generateLicense.js +1 -0
  219. package/dist/web/index.d.ts +5 -0
  220. package/dist/web/index.js +1 -0
  221. package/dist/web/isBotAgent.d.ts +1 -0
  222. package/dist/web/isBotAgent.js +1 -0
  223. package/dist/web/isMatchPathname.d.ts +1 -0
  224. package/dist/web/isMatchPathname.js +1 -0
  225. package/dist/web/isMobile.d.ts +1 -0
  226. package/dist/web/isMobile.js +1 -0
  227. package/dist/web/removeLocalePrefix.d.ts +1 -0
  228. package/dist/web/removeLocalePrefix.js +1 -0
  229. package/package.json +8 -8
  230. package/dist/array.d.ts +0 -13
  231. package/dist/array.js +0 -1
  232. package/dist/date.d.ts +0 -5
  233. package/dist/date.js +0 -1
  234. package/dist/encrypt.d.ts +0 -9
  235. package/dist/encrypt.js +0 -1
  236. package/dist/format.d.ts +0 -8
  237. package/dist/format.js +0 -1
  238. package/dist/math.d.ts +0 -9
  239. package/dist/math.js +0 -1
  240. package/dist/misc.d.ts +0 -4
  241. package/dist/misc.js +0 -1
  242. package/dist/object.d.ts +0 -11
  243. package/dist/object.js +0 -1
  244. package/dist/string.d.ts +0 -19
  245. package/dist/string.js +0 -1
  246. package/dist/types/global.d.ts +0 -13
  247. package/dist/verify.d.ts +0 -11
  248. package/dist/verify.js +0 -1
  249. /package/dist/{types → _types}/global.js +0 -0
@@ -0,0 +1 @@
1
+ export function sum(...t){const e=t.length>0&&"object"==typeof t[0]?t[0]:t;let n=0;for(let t=0,o=e.length;t<o;t+=1)"number"==typeof e[t]&&(n+=e[t]);return n}
@@ -0,0 +1,2 @@
1
+ import type { PositiveNumber } from '../_types/global';
2
+ export declare function debounce<N extends number>(func: (...args: any[]) => void, timeout: PositiveNumber<N>): (...args: any[]) => void;
@@ -0,0 +1 @@
1
+ export function debounce(e,t){let o;return(...u)=>{clearTimeout(o),o=setTimeout((()=>{e.apply(u)}),t)}}
@@ -0,0 +1,2 @@
1
+ import type { PositiveNumber } from '../_types/global';
2
+ export declare function funcTimes<N extends number>(times: PositiveNumber<N>, iteratee: any): Array<any>;
@@ -0,0 +1 @@
1
+ export function funcTimes(n,t){const o=[];for(let c=0;c<n;c+=1)o[c]="function"==typeof t?t.call():t;return o}
@@ -0,0 +1,3 @@
1
+ export { debounce } from './debounce.js';
2
+ export { funcTimes } from './funcTimes.js';
3
+ export { sleep } from './sleep.js';
@@ -0,0 +1 @@
1
+ export{debounce}from"./debounce.js";export{funcTimes}from"./funcTimes.js";export{sleep}from"./sleep.js";
@@ -0,0 +1,2 @@
1
+ import type { PositiveNumber } from '../_types/global';
2
+ export declare function sleep<N extends number>(delay: PositiveNumber<N>): Promise<void>;
@@ -0,0 +1 @@
1
+ export function sleep(e){return new Promise((t=>{setTimeout(t,e)}))}
@@ -0,0 +1,8 @@
1
+ export { objDeleteKeyByValue } from './objDeleteKeyByValue.js';
2
+ export { objFindItemRecursiveByKey } from './objFindItemRecursiveByKey.js';
3
+ export { objMergeNewKey } from './objMergeNewKey.js';
4
+ export { objTo1d } from './objTo1d.js';
5
+ export { objToArray } from './objToArray.js';
6
+ export { objToPrettyStr } from './objToPrettyStr.js';
7
+ export { objToQueryString } from './objToQueryString.js';
8
+ export { objUpdate } from './objUpdate.js';
@@ -0,0 +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";
@@ -0,0 +1,2 @@
1
+ import type { AnyValueObject } from '../_types/global';
2
+ export declare function objDeleteKeyByValue(obj: AnyValueObject, searchValue: string | number | null | undefined, recursive?: boolean): AnyValueObject | null;
@@ -0,0 +1 @@
1
+ import{isObject as e}from"../verify/isObject.js";export function objDeleteKeyByValue(t,o,l=!1){if(!t||"object"!=typeof t)return null;const n=Object.assign(t,{});for(let t=Object.keys(n).length;t>=0;t-=1){const r=Object.keys(n)[t];l&&n[r]&&e(n[r])?objDeleteKeyByValue(n[r],o,l):n[r]===o&&delete n[r]}return n}
@@ -0,0 +1,2 @@
1
+ import type { AnyValueObject } from '../_types/global';
2
+ export declare function objFindItemRecursiveByKey(obj: AnyValueObject | any[], searchKey: string, searchValue: any, childKey: string): AnyValueObject | null;
@@ -0,0 +1 @@
1
+ import{isEmpty as r}from"../verify/isEmpty.js";export function objFindItemRecursiveByKey(t,e,n,i){const o=t=>{let f;f="object"==typeof t&&Array.isArray(t)?t:[t];for(let t=0,u=f.length;t<u;t+=1){if(f[t][e]===n)return f[t];if(!r(f[t][i])){const r=o(f[t][i]);if(r)return r}}return null};return o(t)}
@@ -0,0 +1,4 @@
1
+ import type { AnyValueObject } from '../_types/global';
2
+ export declare function objMergeNewKey(obj: AnyValueObject, obj2: AnyValueObject, options?: {
3
+ arrayAction?: 'original' | 'replace' | 'append';
4
+ }): AnyValueObject | null;
@@ -0,0 +1 @@
1
+ import{isObject as e}from"../verify/isObject.js";export function objMergeNewKey(r,t,o){if(!r||"object"!=typeof r||!t||"object"!=typeof t)return null;const n={...r};return Object.keys(t).forEach((r=>{const i=t[r];if(Object.hasOwn(n,r))if(Array.isArray(n[r])&&Array.isArray(i)){if("append"===o?.arrayAction)n[r].push(...i);else if("replace"===o?.arrayAction)n[r]=i;else if(n[r].length===i.length)for(let t=0;t<n[r].length;t+=1){const s=i[t];e(s)&&(n[r][t]=objMergeNewKey(n[r][t],s,o))}}else e(n[r])&&e(i)?n[r]=objMergeNewKey(n[r],i,o):n[r]=i;else n[r]=i})),n}
@@ -0,0 +1,2 @@
1
+ import type { AnyValueObject } from '../_types/global';
2
+ export declare function objTo1d(obj: AnyValueObject, separator?: string): AnyValueObject;
@@ -0,0 +1 @@
1
+ import{isObject as e}from"../verify/isObject.js";export function objTo1d(t,r="."){if(!r||r.length<1)throw new Error("`separator` must have value at least 1 character.");const o=(t,n="")=>{let s={};const c=Object.keys(t).length,a=n.length<1;for(let l=0;l<c;l+=1){const c=Object.keys(t)[l],h=t[c],i=`${n}${a?"":r}${c}`;e(h)?(s=Object.assign(s,o(h,i)),delete s[c]):s[i]=h}return s};return o(t)}
@@ -0,0 +1,2 @@
1
+ import type { AnyValueObject } from '../_types/global';
2
+ export declare function objToArray(obj: AnyValueObject, recursive?: boolean): any[];
@@ -0,0 +1 @@
1
+ import{isObject as t}from"../verify/isObject.js";export function objToArray(e,r=!1){const o=e=>{const s=[],n=Object.keys(e).length;for(let c=0;c<n;c+=1){const n=Object.keys(e)[c];r&&t(e[n])?s.push([n,o(e[n])]):s.push([n,e[n]])}return s};return o(e)}
@@ -0,0 +1,2 @@
1
+ import type { AnyValueObject } from '../_types/global';
2
+ export declare function objToPrettyStr(obj: AnyValueObject): string;
@@ -0,0 +1 @@
1
+ export function objToPrettyStr(t){return JSON.stringify(t,null,"\t")}
@@ -0,0 +1,2 @@
1
+ import type { AnyValueObject } from '../_types/global';
2
+ export declare function objToQueryString(obj: AnyValueObject): string;
@@ -0,0 +1 @@
1
+ export function objToQueryString(e){return Object.keys(e).map((n=>{let o=e[n];return"object"==typeof o&&(o=JSON.stringify(o)),`${encodeURIComponent(n)}=${encodeURIComponent(o)}`})).join("&")}
@@ -0,0 +1,2 @@
1
+ import { AnyValueObject } from '../_types/global';
2
+ export declare function objUpdate(obj: AnyValueObject, key: string, value: any, recursive?: boolean, upsert?: boolean): AnyValueObject | null;
@@ -0,0 +1 @@
1
+ import{isObject as t}from"../verify/isObject.js";export function objUpdate(e,n,o,c=!1,s=!1){if(!e||"object"!=typeof e)return null;const r=Object.assign(e,{});let j=!1;const b=e=>{for(let s=0;s<Object.keys(e).length;s+=1){const r=Object.keys(e)[s];c&&e[r]&&t(e[r])&&b(e[r]),Object.hasOwn(e,n)&&(e[n]=o,j=!0)}};return b(r),!j&&s&&(r[n]=o),r}
@@ -0,0 +1 @@
1
+ export declare function capitalizeEachWords(str: string, natural?: boolean): string;
@@ -0,0 +1 @@
1
+ import{contains as t}from"../verify/contains.js";import{capitalizeFirst as r}from"./capitalizeFirst.js";export function capitalizeEachWords(o,i){if(!o)return"";const a=o.trim().toLowerCase().split(" ");for(let o=0,e=a.length;o<e;o+=1)i&&t(a[o],["in","on","the","at","and","or","of","for","to","that","a","by","it","is","as","are","were","was","nor","an"],!0)||(a[o]=r(a[o]));return r(a.join(" "))}
@@ -0,0 +1 @@
1
+ export declare function capitalizeEverySentence(str: string, splitChar?: string): string;
@@ -0,0 +1 @@
1
+ export function capitalizeEverySentence(e,t){if(!e)return"";const n=t||".",r=e.split(n);let i,l="";for(let e=0,t=r.length;e<t;e+=1){i=[...r[e]];for(let t=0,n=i.length;t<n;t+=1)if(/[a-zA-Z]/.test(r[e][t])){i[t]=r[e][t].toUpperCase();break}l+=`${i.join("")}${e<t-1?n:""}`}return l}
@@ -0,0 +1 @@
1
+ export declare function capitalizeFirst(str: string): string;
@@ -0,0 +1 @@
1
+ export function capitalizeFirst(t){return t?t.charAt(0).toUpperCase()+t.slice(1):""}
@@ -0,0 +1,17 @@
1
+ export { capitalizeEachWords } from './capitalizeEachWords.js';
2
+ export { capitalizeEverySentence } from './capitalizeEverySentence.js';
3
+ export { capitalizeFirst } from './capitalizeFirst.js';
4
+ export { removeNewLine } from './removeNewLine.js';
5
+ export { removeSpecialChar } from './removeSpecialChar.js';
6
+ export { replaceBetween } from './replaceBetween.js';
7
+ export { split } from './split.js';
8
+ export { strBlindRandom } from './strBlindRandom.js';
9
+ export { strCount } from './strCount.js';
10
+ export { strRandom } from './strRandom.js';
11
+ export { strShuffle } from './strShuffle.js';
12
+ export { strToAscii } from './strToAscii.js';
13
+ export { strUnique } from './strUnique.js';
14
+ export { trim } from './trim.js';
15
+ export { truncate } from './truncate.js';
16
+ export { truncateExpect } from './truncateExpect.js';
17
+ export { urlJoin } from './urlJoin.js';
@@ -0,0 +1 @@
1
+ export{capitalizeEachWords}from"./capitalizeEachWords.js";export{capitalizeEverySentence}from"./capitalizeEverySentence.js";export{capitalizeFirst}from"./capitalizeFirst.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";
@@ -0,0 +1 @@
1
+ export declare function removeNewLine(str: string, replaceTo?: string): string;
@@ -0,0 +1 @@
1
+ export function removeNewLine(e,r=""){return e?e.replace(/(\r\n|\n|\r)/gm,r).trim():""}
@@ -0,0 +1 @@
1
+ export declare function removeSpecialChar(str: string, exceptionCharacters?: string): string;
@@ -0,0 +1 @@
1
+ export function removeSpecialChar(e,r){return e?e.replace(new RegExp(`[^a-zA-Z가-힣ㄱ-ㅎㅏ-ㅣ0-9぀-ヿ㐀-䶿一-鿿豈-﫿ヲ-゚${r??""}]`,"gi"),""):""}
@@ -0,0 +1 @@
1
+ export declare function replaceBetween(str: string, startChar: string, endChar: string, replaceWith?: string): string;
@@ -0,0 +1 @@
1
+ export function replaceBetween(e,t,n,r=""){if(!e)return"";const $=/[.*+?^${}()|[\]\\]/g,c=$.test(t)?`\\${t}`:t,p=$.test(n)?`\\${n}`:n;return e.replace(new RegExp(`${c}.*?${p}`,"g"),r)}
@@ -0,0 +1,2 @@
1
+ export declare function split(str: string, ...splitter: any[]): string[];
2
+ export declare function split(str: string, ...splitter: Array<string>): string[];
@@ -0,0 +1 @@
1
+ export function split(e,...l){if(!e)return[];const t=l.length>0&&"object"==typeof l[0]?l[0]:l,g=t.length;let n="",r="";for(let e=0;e<g;e+=1){const l=t[e];l.length>1?r+=`${r.length<1?"":"|"}${l.replace(/\\/g,"\\\\").replace(/\[/g,"\\[").replace(/]/g,"\\]").replace(/\?/g,"\\?").replace(/\./g,"\\.").replace(/\{/g,"\\{").replace(/}/g,"\\}").replace(/\+/g,"\\+")}`:n+="-"===l||"["===l||"]"===l?`\\${l}`:l}return n.length<1&&r.length<1?[e]:(n.length>0&&(n=`[${n}]`,r.length>0&&(r=`|${r}`)),e.split(new RegExp(`${n}${r}+`,"gi")))}
@@ -0,0 +1,2 @@
1
+ import type { PositiveNumber } from '../_types/global';
2
+ export declare function strBlindRandom<N extends number>(str: string, blindLength: PositiveNumber<N>, blindStr?: string): string;
@@ -0,0 +1 @@
1
+ import{numRandom as t}from"../math/numRandom.js";export function strBlindRandom(n,r,s="*"){if(!n)return"";let o=n,i=0,u=0,e=0;const m=o.length;for(;i<r&&e<m;)u=t(0,m),/[a-zA-Z가-힣]/.test(o.substring(u,u+1))&&(o=`${o.substring(0,u+1)}${s}${o.substring(u+2)}`,i+=1),e+=1;return o}
@@ -0,0 +1 @@
1
+ export declare function strCount(str: string, search: string): number;
@@ -0,0 +1 @@
1
+ export function strCount(n,t){if(!n||!t)return 0;let e=0,r=n.indexOf(t);for(;r>-1;)e+=1,r=n.indexOf(t,r+=t.length);return e}
@@ -0,0 +1,2 @@
1
+ import type { PositiveNumber } from '../_types/global';
2
+ export declare function strRandom<N extends number>(length: PositiveNumber<N>, additionalCharacters?: string): string;
@@ -0,0 +1 @@
1
+ export function strRandom(t,o){const r=`abcdefghijklmnopqrstuvwxyz0123456789${o}`,a=r.length;let n,e="";for(let o=0;o<t;o+=1)n=r.charAt(Math.floor(Math.random()*a)),n=Math.random()<.5?n.toUpperCase():n,e+=n;return e}
@@ -0,0 +1 @@
1
+ export declare function strShuffle(str: string): string;
@@ -0,0 +1 @@
1
+ export function strShuffle(r){return r?[...r].sort((()=>Math.random()-.5)).join(""):""}
@@ -0,0 +1 @@
1
+ export declare function strToAscii(str: string): number[];
@@ -0,0 +1 @@
1
+ export function strToAscii(t){const o=[];for(let r=0;r<t.length;r+=1)o.push(t.charCodeAt(r));return o}
@@ -0,0 +1 @@
1
+ export declare function strUnique(str: string): string;
@@ -0,0 +1 @@
1
+ export function strUnique(n){return n?[...new Set(n)].join(""):""}
@@ -0,0 +1 @@
1
+ export declare function trim(str?: string | null): string | null;
@@ -0,0 +1 @@
1
+ export function trim(r){return"string"==typeof r||r?r.trim().replace(/\s{2,}/g," "):null}
@@ -0,0 +1,2 @@
1
+ import type { PositiveNumber } from '../_types/global';
2
+ export declare function truncate<N extends number>(str: string, length: PositiveNumber<N>, ellipsis?: string): string;
@@ -0,0 +1 @@
1
+ export function truncate(t,n,r=""){if(!t)return"";let e=t;return t.length>n&&(e=t.substring(0,n)+r),e}
@@ -0,0 +1,2 @@
1
+ import type { PositiveNumber } from '../_types/global';
2
+ export declare function truncateExpect<N extends number>(str: string, expectLength: PositiveNumber<N>, endStringChar?: string): string;
@@ -0,0 +1 @@
1
+ export function truncateExpect(t,e,n="."){if(!t)return"";if(t.length<=e)return t;const r=t.slice(-1)===n,l=t.split(n),c=l.length;let i="",u=0;for(let t=0;t<c&&u<e;t+=1)i+=`${l[t]}${t!==c-1||r?n:""}`,u+=l[t].length+n.length;return i}
@@ -0,0 +1 @@
1
+ export declare function urlJoin(...args: any[]): string;
@@ -0,0 +1 @@
1
+ export function urlJoin(...t){if(!t)return"";const r=t.length;let e="",n=0;for(let i=0;i<r;i+=1)null!==t[i]&&void 0!==t[i]&&(0===n||t[i].startsWith("/")||t[i].startsWith("?")||t[i].startsWith("&")?e+=t[i]:e+=`/${t[i]}`,n+=1);return e.replace(/\/$/g,"")}
@@ -0,0 +1 @@
1
+ export declare function between(range: [number, number], number: number, inclusive?: boolean): boolean;
@@ -0,0 +1 @@
1
+ export function between(t,a,n=!1){const e=Math.min.apply(Math,[t[0],t[1]]),p=Math.max.apply(Math,[t[0],t[1]]);return n?a>=e&&a<=p:a>e&&a<p}
@@ -0,0 +1 @@
1
+ export declare function contains(str: any[] | string, search: any[] | string, exact?: boolean): boolean;
@@ -0,0 +1 @@
1
+ export function contains(e,n,t=!1){if("string"==typeof n)return!(e.length<1)&&-1!==e.indexOf(n);for(let r=0,f=n.length;r<f;r+=1)if(t){if(e===n[r])return!0}else if(-1!==e.indexOf(n[r]))return!0;return!1}
@@ -0,0 +1,11 @@
1
+ export { between } from './between.js';
2
+ export { contains } from './contains.js';
3
+ export { is2dArray } from './is2dArray.js';
4
+ export { isEmail } from './isEmail.js';
5
+ export { isEmpty } from './isEmpty.js';
6
+ export { isEqual } from './isEqual.js';
7
+ export { isEqualStrict } from './isEqualStrict.js';
8
+ export { isObject } from './isObject.js';
9
+ export { isTrueMinimumNumberOfTimes } from './isTrueMinimumNumberOfTimes.js';
10
+ export { isUrl } from './isUrl.js';
11
+ export { len } from './len.js';
@@ -0,0 +1 @@
1
+ export{between}from"./between.js";export{contains}from"./contains.js";export{is2dArray}from"./is2dArray.js";export{isEmail}from"./isEmail.js";export{isEmpty}from"./isEmpty.js";export{isEqual}from"./isEqual.js";export{isEqualStrict}from"./isEqualStrict.js";export{isObject}from"./isObject.js";export{isTrueMinimumNumberOfTimes}from"./isTrueMinimumNumberOfTimes.js";export{isUrl}from"./isUrl.js";export{len}from"./len.js";
@@ -0,0 +1 @@
1
+ export declare function is2dArray(array: any[]): boolean;
@@ -0,0 +1 @@
1
+ export function is2dArray(r){return r.filter(Array.isArray).length>0}
@@ -0,0 +1 @@
1
+ export declare function isEmail(email: string): boolean;
@@ -0,0 +1 @@
1
+ export function isEmail(a){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(a)}
@@ -0,0 +1 @@
1
+ export declare function isEmpty(data?: any): boolean;
@@ -0,0 +1 @@
1
+ export function 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}}
@@ -0,0 +1 @@
1
+ export declare function isEqual(leftOperand: any, ...rightOperand: Array<any>): boolean;
@@ -0,0 +1 @@
1
+ export function isEqual(t,...e){const n=e.length>0&&"object"==typeof e[0]?e[0]:e,o=n.length;for(let e=0;e<o;e+=1)if(n[e]!=t)return!1;return!0}
@@ -0,0 +1 @@
1
+ export declare function isEqualStrict(leftOperand: any, ...rightOperand: Array<any>): boolean;
@@ -0,0 +1 @@
1
+ export function isEqualStrict(t,...e){const n=e.length>0&&"object"==typeof e[0]?e[0]:e,r=n.length;for(let e=0;e<r;e+=1)if(n[e]!==t)return!1;return!0}
@@ -0,0 +1 @@
1
+ export declare function isObject(data: any): boolean;
@@ -0,0 +1 @@
1
+ export function isObject(t){return null!=t&&Object.getPrototypeOf(t)===Object.prototype}
@@ -0,0 +1 @@
1
+ export declare function isTrueMinimumNumberOfTimes(conditions: any[], minimumCount?: number): boolean;
@@ -0,0 +1 @@
1
+ export function isTrueMinimumNumberOfTimes(e,t=1){const n=e.length;let o=0;for(let t=0;t<n;t+=1)"boolean"==typeof e[t]&&e[t]&&(o+=1);return o>=t}
@@ -0,0 +1 @@
1
+ export declare function isUrl(url: string, withProtocol?: boolean, strict?: boolean): boolean;
@@ -0,0 +1 @@
1
+ export function isUrl(t,r=!1,n=!1){if(n&&-1===t.indexOf("."))return!1;try{new URL(`${r&&-1===t.indexOf("://")?"https://":""}${t}`).toString()}catch(t){return!1}return!0}
@@ -0,0 +1 @@
1
+ export declare function len(data: any): number;
@@ -0,0 +1 @@
1
+ export function len(e){if(!e)return 0;switch(typeof e){case"object":return Array.isArray(e)?e.length:Object.keys(e).length;case"number":case"bigint":return e.toString().length;case"boolean":return e?4:5;case"function":return e().length;default:return e.length}}
@@ -0,0 +1,2 @@
1
+ import { LicenseOption } from '../_types/global';
2
+ export declare function generateLicense(options: LicenseOption): string;
@@ -0,0 +1 @@
1
+ export function generateLicense(e){const i=e.htmlBr?"<br/>":"\n",t=`${e.yearStart}${e.yearEnd?`-${e.yearEnd}`:""}`,o=`${e.author}${e.email?` <${e.email}>`:""}`;return"apache20"===e.type.replace(/\.-_,\s/g,"").toLowerCase()?`Copyright ${t} ${o}${i}${i}Licensed under the Apache License, Version 2.0 (the "License");${i}you may not use this file except in compliance with the License.${i}You may obtain a copy of the License at${i}${i} http://www.apache.org/licenses/LICENSE-2.0${i}${i}Unless required by applicable law or agreed to in writing, software${i}distributed under the License is distributed on an "AS IS" BASIS,${i}WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.${i}See the License for the specific language governing permissions and${i}limitations under the License.`:`Copyright (c) ${t} ${o}${i}${i}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:${i}${i}The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.${i}${i}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.`}
@@ -0,0 +1,5 @@
1
+ export { generateLicense } from './generateLicense.js';
2
+ export { isBotAgent } from './isBotAgent.js';
3
+ export { isMatchPathname } from './isMatchPathname.js';
4
+ export { isMobile } from './isMobile.js';
5
+ export { removeLocalePrefix } from './removeLocalePrefix.js';
@@ -0,0 +1 @@
1
+ export{generateLicense}from"./generateLicense.js";export{isBotAgent}from"./isBotAgent.js";export{isMatchPathname}from"./isMatchPathname.js";export{isMobile}from"./isMobile.js";export{removeLocalePrefix}from"./removeLocalePrefix.js";
@@ -0,0 +1 @@
1
+ export declare function isBotAgent(userAgent: string): boolean;
@@ -0,0 +1 @@
1
+ export function isBotAgent(e){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(e)}
@@ -0,0 +1 @@
1
+ export declare function isMatchPathname(pathname: string, matcher: string | string[]): boolean;
@@ -0,0 +1 @@
1
+ export function isMatchPathname(t,e){if(!t||!e||e?.length<1)throw new Error("`url` and `matcher` must be set");const r="string"==typeof e?[e]:e,n=t.split("?")[0].replace(/\/$/,"");return r.some((t=>{if("*"===t||"/*"===t)return!0;const e=t.replace(/\*$/,"");return t.endsWith("*")?n.startsWith(e):e===n}))}
@@ -0,0 +1 @@
1
+ export declare function isMobile(userAgent: string): boolean;
@@ -0,0 +1 @@
1
+ export function isMobile(i){return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series([46])0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(i)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br([ev])w|bumb|bw-([nu])|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do([cp])o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly([-_])|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c([- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac([ \-/])|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja([tv])a|jbro|jemu|jigs|kddi|keji|kgt([ /])|klon|kpt |kwc-|kyo([ck])|le(no|xi)|lg( g|\/([klu])|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t([- ov])|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30([02])|n50([025])|n7(0([01])|10)|ne(([cm])-|on|tf|wf|wg|wt)|nok([6i])|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan([adt])|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c([-01])|47|mc|nd|ri)|sgh-|shar|sie([-m])|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel([im])|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c([- ])|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(i.substring(0,4))}
@@ -0,0 +1 @@
1
+ export declare function removeLocalePrefix(urlOrPathname: string, locales: string | string[]): string;
@@ -0,0 +1 @@
1
+ export function removeLocalePrefix(e,r){const n=Array.isArray(r)?r:[r];if(n.includes(e.replace(/^\//,"")))return"";if("/"===e)return"/";const t=n.join("|");try{const r=new URL(e);return"/"===r.pathname||n.includes(r.pathname.replace(/^\//,""))?r.origin:`${r.origin}${r.pathname.replace(new RegExp(`^/(${t})/`),"/")}`.replace(/\/$/,"")}catch{let r=e;return r.startsWith("/")||(r=`/${r}`),r.endsWith("/")&&(r=r.replace(/\/$/,"")),new RegExp(`^/(${t})$`).test(r)?"/":r.replace(new RegExp(`^/(${t})/`),"/")}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qsu",
3
- "version": "1.6.4",
4
- "description": "QSU is a lightweight and simple module with a variety of built-in utility functions that you can utilize in your NodeJS projects.",
3
+ "version": "1.7.0",
4
+ "description": "QSU is a lightweight and simple module with a variety of built-in utility functions that you can utilize in your Node.js projects.",
5
5
  "author": "CDGet <jooy2.contact@gmail.com>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://qsu.cdget.com",
@@ -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 --project tsconfig.prod.json && npm run minify",
18
+ "build": "tsc --project tsconfig.prod.json && npm run minify",
19
19
  "test": "npm run build && glob -c \"tsx --test\" \"./test/**/*.test.ts\"",
20
20
  "lint": "eslint .",
21
21
  "lint:fix": "eslint --fix .",
@@ -65,7 +65,7 @@
65
65
  "file"
66
66
  ],
67
67
  "devDependencies": {
68
- "@types/node": "22.10.2",
68
+ "@types/node": "22.13.5",
69
69
  "@typescript-eslint/eslint-plugin": "7.14.1",
70
70
  "@typescript-eslint/parser": "7.14.1",
71
71
  "dayjs": "^1.11.13",
@@ -73,10 +73,10 @@
73
73
  "eslint-config-airbnb": "19.0.4",
74
74
  "eslint-config-prettier": "9.1.0",
75
75
  "eslint-plugin-import": "2.29.1",
76
- "glob": "^11.0.0",
77
- "prettier": "^3.4.2",
76
+ "glob": "^11.0.1",
77
+ "prettier": "^3.5.2",
78
78
  "terser-glob": "^1.1.0",
79
- "tsx": "^4.19.2",
80
- "typescript": "^5.7.2"
79
+ "tsx": "^4.19.3",
80
+ "typescript": "^5.7.3"
81
81
  }
82
82
  }
package/dist/array.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import type { NumberValueObject, PositiveNumber } from './types/global.js';
2
- export declare function arrShuffle(array: any[]): any[];
3
- export declare function arrWithDefault(defaultValue: any, length?: number): any[];
4
- export declare function arrUnique(array: any[]): any[];
5
- export declare function arrWithNumber(start: number, end: number): number[];
6
- export declare function average(array: number[]): number;
7
- export declare function arrMove<N extends number>(array: any[], from: PositiveNumber<N>, to: PositiveNumber<N>): any[];
8
- export declare function arrTo1dArray(array: any[]): any[];
9
- export declare function arrRepeat<N extends number>(array: any, count: PositiveNumber<N>): any[];
10
- export declare function arrCount(array: string[] | number[]): NumberValueObject;
11
- export declare function sortByObjectKey(array: any[], key: string, descending?: boolean, numerically?: boolean): any[];
12
- export declare function sortNumeric(array: string[], descending?: boolean): string[];
13
- export declare function arrGroupByMaxCount(array: any[], maxLengthPerGroup?: number): any[];
package/dist/array.js DELETED
@@ -1 +0,0 @@
1
- import{is2dArray as r,isObject as t}from"./verify.js";export function arrShuffle(r){if(1===r.length)return r[0];const t=r;for(let e=r.length-1;e>0;e-=1){const n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[r[n],r[e]]}return t}export function arrWithDefault(r,t=0){return t<1?[]:Array(t).fill(r)}export function arrUnique(t){return r(t)?Array.from(new Set(t.map((r=>JSON.stringify(r)))),(r=>JSON.parse(r))):[...new Set(t)]}export function arrWithNumber(r,t){if(r>t)throw new Error("`end` is greater than `start`.");return Array.from({length:t-r+1},((t,e)=>e+r))}export function average(r){return r.reduce(((r,t)=>r+t),0)/r.length}export function arrMove(r,t,e){const n=r.length;if(n<=t||n<=e)throw new Error("Invalid move params");return r.splice(e,0,r.splice(t,1)[0]),r}export function arrTo1dArray(t){const e=t=>{const n=[],o=t.length;for(let u=0;u<o;u+=1)"object"!=typeof t[u]?n.push(t[u]):r(t[u])?n.push(...e(t[u])):n.push(...t[u]);return n};return e(t)}export function arrRepeat(r,e){if(!r||e<1||"object"!=typeof r)return[];const n=t(r),o=[];for(let t=0,u=e;t<u;t+=1)n?o.push(r):o.push(...r);return o}export function arrCount(r){const t={};for(let e=0;e<r.length;e+=1){const n=r[e];t[n]=(t[n]||0)+1}return t}export function sortByObjectKey(r,t,e=!1,n=!1){if(n){const n=new Intl.Collator([],{numeric:!0}),o=r.sort(((r,e)=>n.compare(r[t],e[t])));return e?o.reverse():o}return r.sort(((r,n)=>e?r[t]>n[t]?-1:r[t]<n[t]?1:0:r[t]<n[t]?-1:r[t]>n[t]?1:0))}export function sortNumeric(r,t=!1){const e=new Intl.Collator([],{numeric:!0}),n=r.sort(((r,t)=>e.compare(r,t)));return t?n.reverse():n}export function arrGroupByMaxCount(r,t=1){const e=[],n=r.length;let o=[];for(let u=0;u<n;u+=1)o.length===t&&(e.push(o),o=[]),o.push(r[u]);return o.length>0&&e.push(o),e}
package/dist/date.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export declare function dayDiff(date1: Date, date2?: Date): number;
2
- export declare function today(separator?: string, yearFirst?: boolean): string;
3
- export declare function isValidDate(dateYYYYMMDD: string): boolean;
4
- export declare function dateToYYYYMMDD(date: Date, separator?: string): string;
5
- export declare function createDateListFromRange(startDate: Date, endDate: Date): string[];
package/dist/date.js DELETED
@@ -1 +0,0 @@
1
- export function dayDiff(t,e){const r=e||new Date;return Math.ceil(Math.abs(r.getTime()-t.getTime())/864e5)}export function today(t="-",e=!0){const r=new Date,a=r.getMonth()+1,n=r.getDate(),o=[`${a<10?"0":""}${a}`,`${n<10?"0":""}${n}`];return e?o.unshift(r.getFullYear().toString()):o.push(r.getFullYear().toString()),o.join(t)}export function 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)}`)}export function 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}`}export function createDateListFromRange(t,e){if(!isValidDate(dateToYYYYMMDD(t))||!isValidDate(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=dateToYYYYMMDD(e),a=[];let n=t.getFullYear(),o=t.getMonth()+1,i=t.getDate(),s="";const d=(t,e,r)=>`${t}-${e<10?"0":""}${e}-${r<10?"0":""}${r}`;for(;r!==s;){/[0-9]{4}-12-31/g.test(s)&&(n+=1,o=1,i=1);const t=d(n,o,i);isValidDate(t)?(i+=1,a.push(t),s=t):(o+=1,i=1,s=d(n,o,i))}return a}
package/dist/encrypt.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export declare function encrypt(str: string, secret: string, algorithm?: string, ivSize?: number, toBase64?: boolean): string;
2
- export declare function decrypt(str: string, secret: string, algorithm?: string, toBase64?: boolean): string;
3
- export declare function objectId(): string;
4
- export declare function md5Hash(str: string): string;
5
- export declare function sha1Hash(str: string): string;
6
- export declare function sha256Hash(str: string): string;
7
- export declare function encodeBase64(str: string): string;
8
- export declare function decodeBase64(encodedStr: string): string;
9
- export declare function strToNumberHash(str: string): number;
package/dist/encrypt.js DELETED
@@ -1 +0,0 @@
1
- import{randomBytes as t,createCipheriv as e,createDecipheriv as r,createHash as n}from"crypto";export function encrypt(r,n,o="aes-256-cbc",f=16,u=!1){if(!r||r.length<1)return"";const a=t(f),c=e(o,n,a);let i=c.update(r);i=Buffer.concat([i,c.final()]);const s=u?"base64":"hex";return`${a.toString(s)}:${i.toString(s)}`}export function decrypt(t,e,n="aes-256-cbc",o=!1){if(!t||t.length<1)return"";const f=o?"base64":"hex",u=t.split(":"),a=r(n,e,Buffer.from(u.shift(),f));let c=a.update(Buffer.from(u.join(":"),f));return c=Buffer.concat([c,a.final()]),c.toString()}export function objectId(){return Math.floor(Date.now()/1e3).toString(16)+"x".repeat(16).replace(/x/g,(()=>Math.floor(16*Math.random()).toString(16)))}export function md5Hash(t){return n("md5").update(t).digest("hex")}export function sha1Hash(t){return n("sha1").update(t).digest("hex")}export function sha256Hash(t){return n("sha256").update(t).digest("hex")}export function encodeBase64(t){return Buffer.from(t,"utf8").toString("base64")}export function decodeBase64(t){return Buffer.from(t,"base64").toString("utf8")}export function strToNumberHash(t){if(!t)return 0;let e=0;for(let r=0;r<t.length;r+=1)e=(e<<5)-e+t.charCodeAt(r),e|=0;return e}
package/dist/format.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import type { AnyValueObject, DurationOptions, PositiveNumber } from './types/global.js';
2
- export declare function numberFormat(number: number | string): string;
3
- export declare function fileName(filePath: string, withExtension?: boolean): string;
4
- export declare function fileSize<N extends number>(bytes: PositiveNumber<N>, decimals?: number): string;
5
- export declare function fileExt(filePath: string): string;
6
- export declare function duration(milliseconds: number, options?: DurationOptions): string;
7
- export declare function safeJSONParse(jsonString: any, fallback?: {}): AnyValueObject;
8
- export declare function safeParseInt(value: any, fallback?: number, radix?: number): number;
package/dist/format.js DELETED
@@ -1 +0,0 @@
1
- import{basename as t,extname as r,win32 as e}from"path";export function numberFormat(t){return(new Intl.NumberFormat).format(t)}export function fileName(n,o=!1){return n?-1===n.indexOf("/")?o?e.basename(n):e.basename(n,r(n)):o?t(n):t(n,r(n)):""}export function fileSize(t,r=2){if(!t||0===t||t<0)return"0 Bytes";const e=Math.floor(Math.log(t)/Math.log(1024));return`${parseFloat((t/1024**e).toFixed(r<0?0:r))} ${["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][e]}`}export function fileExt(t){if(-1===t.indexOf("."))return"Unknown";const r=t.trim().toLowerCase().split(".");return r.length>0?r[r.length-1]:"Unknown"}export function duration(t,r){const{useShortString:e=!1,useSpace:n=!0,withZeroValue:o=!1,separator:i=" "}={...r},a=[{name:"Millisecond",short:"ms",divider:1e3},{name:"Second",short:"S",divider:60},{name:"Minute",short:"M",divider:60},{name:"Hour",short:"H",divider:24},{name:"Day",short:"D",divider:31}],s=[];let u=t;for(let t=0;t<a.length;t+=1){const r=a[t];let i=u%r.divider;t===a.length-1?i=Math.trunc(u):u=(u-i)/r.divider,(o||!o&&0!==i)&&s.push(`${i}${n?" ":""}${e?r.short:`${r.name}${i<2?"":"s"}`}`)}return s.reverse().join(i)}export function safeJSONParse(t,r={}){if(!t)return r;if(Array.isArray(t)||"object"==typeof t)try{return JSON.parse(JSON.stringify(t))}catch(t){return r}try{return JSON.parse(t)}catch(t){return r}}export function safeParseInt(t,r=0,e=10){if(!t||t.toString().length<1)return r;try{return parseInt(t.toString().split(".")[0],e)}catch(t){return r}}
package/dist/math.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export declare function numRandom(min: number, max: number): number;
2
- export declare function sum(...args: any[]): number;
3
- export declare function sum(...args: Array<number>): number;
4
- export declare function mul(...args: any[]): number;
5
- export declare function mul(...args: Array<number>): number;
6
- export declare function sub(...args: any[]): number;
7
- export declare function sub(...args: Array<number>): number;
8
- export declare function div(...args: any[]): number;
9
- export declare function div(...args: Array<number>): number;
package/dist/math.js DELETED
@@ -1 +0,0 @@
1
- export function numRandom(t,e){if(!t&&!e)return Math.random()>.5?1:0;const n=e||t,o=!e||t>=e?null:t;return Math.floor(Math.random()*(o?n-o+1:n+1))+(o||0)}export function sum(...t){const e=t.length>0&&"object"==typeof t[0]?t[0]:t;let n=0;for(let t=0,o=e.length;t<o;t+=1)"number"==typeof e[t]&&(n+=e[t]);return n}export function mul(...t){const e=t.length>0&&"object"==typeof t[0]?t[0]:t;let n=e[0];for(let t=1,o=e.length;t<o;t+=1)"number"==typeof e[t]&&(n*=e[t]);return n}export function sub(...t){const e=t.length>0&&"object"==typeof t[0]?t[0]:t;let n=e[0];for(let t=1,o=e.length;t<o;t+=1)"number"==typeof e[t]&&(n-=e[t]);return n}export function div(...t){const e=t.length>0&&"object"==typeof t[0]?t[0]:t;let n=e[0];for(let t=1,o=e.length;t<o;t+=1)"number"==typeof e[t]&&(n/=e[t]);return n}
package/dist/misc.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type { PositiveNumber } from './types/global.js';
2
- export declare function sleep<N extends number>(delay: PositiveNumber<N>): Promise<void>;
3
- export declare function funcTimes<N extends number>(times: PositiveNumber<N>, iteratee: any): Array<any>;
4
- export declare function debounce<N extends number>(func: (...args: any[]) => void, timeout: PositiveNumber<N>): (...args: any[]) => void;
package/dist/misc.js DELETED
@@ -1 +0,0 @@
1
- export function sleep(e){return new Promise((t=>{setTimeout(t,e)}))}export function funcTimes(e,t){const n=[];for(let o=0;o<e;o+=1)n[o]="function"==typeof t?t.call():t;return n}export function debounce(e,t){let n;return(...o)=>{clearTimeout(n),n=setTimeout((()=>{e.apply(o)}),t)}}
package/dist/object.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import type { AnyValueObject } from './types/global.js';
2
- export declare function objToQueryString(obj: AnyValueObject): string;
3
- export declare function objFindItemRecursiveByKey(obj: AnyValueObject | any[], searchKey: string, searchValue: any, childKey: string): AnyValueObject | null;
4
- export declare function objToPrettyStr(obj: AnyValueObject): string;
5
- export declare function objToArray(obj: AnyValueObject, recursive?: boolean): any[];
6
- export declare function objTo1d(obj: AnyValueObject, separator?: string): AnyValueObject;
7
- export declare function objDeleteKeyByValue(obj: AnyValueObject, searchValue: string | number | null | undefined, recursive?: boolean): AnyValueObject | null;
8
- export declare function objUpdate(obj: AnyValueObject, key: string, value: any, recursive?: boolean, upsert?: boolean): AnyValueObject | null;
9
- export declare function objMergeNewKey(obj: AnyValueObject, obj2: AnyValueObject, options?: {
10
- arrayAction?: 'original' | 'replace' | 'append';
11
- }): AnyValueObject | null;