full-utils 1.0.11 → 2.0.1

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 (170) hide show
  1. package/README.md +189 -1
  2. package/dist/browser.cjs +3 -0
  3. package/dist/browser.cjs.map +1 -0
  4. package/dist/browser.d.cts +1 -0
  5. package/dist/browser.d.ts +1 -0
  6. package/dist/browser.mjs +3 -0
  7. package/dist/browser.mjs.map +1 -0
  8. package/dist/index.cjs +3 -0
  9. package/dist/index.cjs.map +1 -0
  10. package/dist/index.d.cts +4495 -0
  11. package/dist/index.d.ts +4495 -49
  12. package/dist/index.mjs +3 -0
  13. package/dist/index.mjs.map +1 -0
  14. package/dist/node.cjs +3 -0
  15. package/dist/node.cjs.map +1 -0
  16. package/dist/node.d.cts +166 -0
  17. package/dist/node.d.ts +166 -0
  18. package/dist/node.mjs +3 -0
  19. package/dist/node.mjs.map +1 -0
  20. package/package.json +65 -19
  21. package/dist/index.js +0 -100
  22. package/dist/index.js.map +0 -1
  23. package/dist/src/from/fromJSON.d.ts +0 -5
  24. package/dist/src/from/fromJSON.js +0 -71
  25. package/dist/src/from/fromJSON.js.map +0 -1
  26. package/dist/src/from/fromTimestamp.d.ts +0 -6
  27. package/dist/src/from/fromTimestamp.js +0 -8
  28. package/dist/src/from/fromTimestamp.js.map +0 -1
  29. package/dist/src/index.d.ts +0 -49
  30. package/dist/src/index.js +0 -100
  31. package/dist/src/index.js.map +0 -1
  32. package/dist/src/is/isArr.d.ts +0 -1
  33. package/dist/src/is/isArr.js +0 -7
  34. package/dist/src/is/isArr.js.map +0 -1
  35. package/dist/src/is/isArrFilled.d.ts +0 -1
  36. package/dist/src/is/isArrFilled.js +0 -8
  37. package/dist/src/is/isArrFilled.js.map +0 -1
  38. package/dist/src/is/isBool.d.ts +0 -1
  39. package/dist/src/is/isBool.js +0 -7
  40. package/dist/src/is/isBool.js.map +0 -1
  41. package/dist/src/is/isDate.d.ts +0 -1
  42. package/dist/src/is/isDate.js +0 -16
  43. package/dist/src/is/isDate.js.map +0 -1
  44. package/dist/src/is/isEmail.d.ts +0 -1
  45. package/dist/src/is/isEmail.js +0 -9
  46. package/dist/src/is/isEmail.js.map +0 -1
  47. package/dist/src/is/isExists.d.ts +0 -1
  48. package/dist/src/is/isExists.js +0 -7
  49. package/dist/src/is/isExists.js.map +0 -1
  50. package/dist/src/is/isFunc.d.ts +0 -1
  51. package/dist/src/is/isFunc.js +0 -7
  52. package/dist/src/is/isFunc.js.map +0 -1
  53. package/dist/src/is/isIp.d.ts +0 -1
  54. package/dist/src/is/isIp.js +0 -13
  55. package/dist/src/is/isIp.js.map +0 -1
  56. package/dist/src/is/isMac.d.ts +0 -1
  57. package/dist/src/is/isMac.js +0 -8
  58. package/dist/src/is/isMac.js.map +0 -1
  59. package/dist/src/is/isNum.d.ts +0 -1
  60. package/dist/src/is/isNum.js +0 -7
  61. package/dist/src/is/isNum.js.map +0 -1
  62. package/dist/src/is/isNumFloat.d.ts +0 -1
  63. package/dist/src/is/isNumFloat.js +0 -8
  64. package/dist/src/is/isNumFloat.js.map +0 -1
  65. package/dist/src/is/isNumN.d.ts +0 -1
  66. package/dist/src/is/isNumN.js +0 -8
  67. package/dist/src/is/isNumN.js.map +0 -1
  68. package/dist/src/is/isNumNZ.d.ts +0 -1
  69. package/dist/src/is/isNumNZ.js +0 -8
  70. package/dist/src/is/isNumNZ.js.map +0 -1
  71. package/dist/src/is/isNumP.d.ts +0 -1
  72. package/dist/src/is/isNumP.js +0 -8
  73. package/dist/src/is/isNumP.js.map +0 -1
  74. package/dist/src/is/isNumPZ.d.ts +0 -1
  75. package/dist/src/is/isNumPZ.js +0 -8
  76. package/dist/src/is/isNumPZ.js.map +0 -1
  77. package/dist/src/is/isObj.d.ts +0 -1
  78. package/dist/src/is/isObj.js +0 -10
  79. package/dist/src/is/isObj.js.map +0 -1
  80. package/dist/src/is/isObjFilled.d.ts +0 -1
  81. package/dist/src/is/isObjFilled.js +0 -8
  82. package/dist/src/is/isObjFilled.js.map +0 -1
  83. package/dist/src/is/isPassword.d.ts +0 -10
  84. package/dist/src/is/isPassword.js +0 -26
  85. package/dist/src/is/isPassword.js.map +0 -1
  86. package/dist/src/is/isPhone.d.ts +0 -1
  87. package/dist/src/is/isPhone.js +0 -35
  88. package/dist/src/is/isPhone.js.map +0 -1
  89. package/dist/src/is/isStr.d.ts +0 -1
  90. package/dist/src/is/isStr.js +0 -7
  91. package/dist/src/is/isStr.js.map +0 -1
  92. package/dist/src/is/isStrBool.d.ts +0 -1
  93. package/dist/src/is/isStrBool.js +0 -12
  94. package/dist/src/is/isStrBool.js.map +0 -1
  95. package/dist/src/is/isStrFilled.d.ts +0 -1
  96. package/dist/src/is/isStrFilled.js +0 -8
  97. package/dist/src/is/isStrFilled.js.map +0 -1
  98. package/dist/src/is/isStrOrderType.d.ts +0 -1
  99. package/dist/src/is/isStrOrderType.js +0 -12
  100. package/dist/src/is/isStrOrderType.js.map +0 -1
  101. package/dist/src/is/isVar.d.ts +0 -1
  102. package/dist/src/is/isVar.js +0 -8
  103. package/dist/src/is/isVar.js.map +0 -1
  104. package/dist/src/net/netTCP.d.ts +0 -6
  105. package/dist/src/net/netTCP.js +0 -52
  106. package/dist/src/net/netTCP.js.map +0 -1
  107. package/dist/src/to/toArrFuncArgs.d.ts +0 -1
  108. package/dist/src/to/toArrFuncArgs.js +0 -139
  109. package/dist/src/to/toArrFuncArgs.js.map +0 -1
  110. package/dist/src/to/toBool.d.ts +0 -1
  111. package/dist/src/to/toBool.js +0 -23
  112. package/dist/src/to/toBool.js.map +0 -1
  113. package/dist/src/to/toCellDate.d.ts +0 -1
  114. package/dist/src/to/toCellDate.js +0 -12
  115. package/dist/src/to/toCellDate.js.map +0 -1
  116. package/dist/src/to/toDateStr.d.ts +0 -1
  117. package/dist/src/to/toDateStr.js +0 -14
  118. package/dist/src/to/toDateStr.js.map +0 -1
  119. package/dist/src/to/toGB.d.ts +0 -1
  120. package/dist/src/to/toGB.js +0 -47
  121. package/dist/src/to/toGB.js.map +0 -1
  122. package/dist/src/to/toGH.d.ts +0 -1
  123. package/dist/src/to/toGH.js +0 -36
  124. package/dist/src/to/toGH.js.map +0 -1
  125. package/dist/src/to/toH.d.ts +0 -1
  126. package/dist/src/to/toH.js +0 -36
  127. package/dist/src/to/toH.js.map +0 -1
  128. package/dist/src/to/toInetAton.d.ts +0 -1
  129. package/dist/src/to/toInetAton.js +0 -18
  130. package/dist/src/to/toInetAton.js.map +0 -1
  131. package/dist/src/to/toInetNtoa.d.ts +0 -1
  132. package/dist/src/to/toInetNtoa.js +0 -16
  133. package/dist/src/to/toInetNtoa.js.map +0 -1
  134. package/dist/src/to/toJSON.d.ts +0 -1
  135. package/dist/src/to/toJSON.js +0 -14
  136. package/dist/src/to/toJSON.js.map +0 -1
  137. package/dist/src/to/toLower.d.ts +0 -1
  138. package/dist/src/to/toLower.js +0 -14
  139. package/dist/src/to/toLower.js.map +0 -1
  140. package/dist/src/to/toNull.d.ts +0 -1
  141. package/dist/src/to/toNull.js +0 -11
  142. package/dist/src/to/toNull.js.map +0 -1
  143. package/dist/src/to/toNum.d.ts +0 -1
  144. package/dist/src/to/toNum.js +0 -40
  145. package/dist/src/to/toNum.js.map +0 -1
  146. package/dist/src/to/toPhone.d.ts +0 -1
  147. package/dist/src/to/toPhone.js +0 -24
  148. package/dist/src/to/toPhone.js.map +0 -1
  149. package/dist/src/to/toPoolName.d.ts +0 -1
  150. package/dist/src/to/toPoolName.js +0 -19
  151. package/dist/src/to/toPoolName.js.map +0 -1
  152. package/dist/src/to/toPortions.d.ts +0 -1
  153. package/dist/src/to/toPortions.js +0 -16
  154. package/dist/src/to/toPortions.js.map +0 -1
  155. package/dist/src/to/toRangeip.d.ts +0 -1
  156. package/dist/src/to/toRangeip.js +0 -24
  157. package/dist/src/to/toRangeip.js.map +0 -1
  158. package/dist/src/to/toSqlUpdateMany.d.ts +0 -1
  159. package/dist/src/to/toSqlUpdateMany.js +0 -39
  160. package/dist/src/to/toSqlUpdateMany.js.map +0 -1
  161. package/dist/src/to/toTimestamp.d.ts +0 -6
  162. package/dist/src/to/toTimestamp.js +0 -11
  163. package/dist/src/to/toTimestamp.js.map +0 -1
  164. package/dist/src/to/toTrim.d.ts +0 -1
  165. package/dist/src/to/toTrim.js +0 -10
  166. package/dist/src/to/toTrim.js.map +0 -1
  167. package/dist/src/to/toUndefined.d.ts +0 -1
  168. package/dist/src/to/toUndefined.js +0 -11
  169. package/dist/src/to/toUndefined.js.map +0 -1
  170. package/dist/tsconfig.build.tsbuildinfo +0 -1
package/README.md CHANGED
@@ -1,2 +1,190 @@
1
1
  # full-utils
2
- ## A set of pure functions for all occasions.
2
+ Lightweight, dependency-free collection of pure TypeScript/JavaScript utility functions for everyday development.
3
+ It’s designed to be clear, fast, and easy to use — both in Node.js and in browser environments.
4
+
5
+ Whether you work with strings, numbers, dates, IPs, JSON, arrays, or type checks, this package provides you with a well-documented, consistent, and predictable API.
6
+
7
+ ## Installation
8
+ ```bash
9
+ # with npm
10
+ npm install full-utils
11
+
12
+ # or with yarn
13
+ yarn add full-utils
14
+
15
+ # or with pnpm
16
+ pnpm add full-utils
17
+
18
+ ```
19
+ ## Works in:
20
+ - Node.js (CommonJS & ESM)
21
+ - Browser / Front-end
22
+ - TypeScript or plain JavaScript
23
+
24
+ ## Concept
25
+
26
+ full-utils follows a simple philosophy:
27
+ Small, pure, and type-safe utilities — reusable across any kind of project, from scripts to large applications.
28
+
29
+ All functions:
30
+ - Are pure (no side effects)
31
+ - Include TypeScript typings
32
+ - Have clear naming
33
+ - Are documented via TypeDoc
34
+ - Work without any external dependencies
35
+
36
+ ## Documentation
37
+ Full API documentation:
38
+ - full-utils.docs.ihor.bielchenko.com
39
+
40
+ ## Quick Example
41
+ ```javascript
42
+ import { isStrFilled, formatDateToString, rangeIPv4 } from 'full-utils';
43
+
44
+ // Check if a string has content
45
+ console.log(isStrFilled('Hello')); // true
46
+
47
+ // Format current date as 'YYYY-MM-DD HH:mm:ss'
48
+ console.log(formatDateToString(new Date()));
49
+
50
+ // Generate all IPs in a range
51
+ for (const ip of rangeIPv4('192.168.0.1', '192.168.0.5')) {
52
+ console.log(ip);
53
+ }
54
+
55
+ ```
56
+
57
+ ## Modules Overview
58
+ ### Number utilities (/num)
59
+ Work with numbers precisely — including BigInt-based fixed decimals.
60
+
61
+ | Function | Description |
62
+ | ----------------------------------------- | ---------------------------------------------------------- |
63
+ | `formatToNum` | Parse strings/numbers to normalized numeric values. |
64
+ | `parseToFixedDecimal` | Convert any input to a precise fixed-decimal structure. |
65
+ | `roundFixedDecimal` | Round a fixed-decimal number using half-up or trunc modes. |
66
+ | `convertExponentialToParts` | Convert exponential notation into decimal components. |
67
+ | `fixedDecimalToNum` / `fixedDecimalToStr` | Convert precise decimals to number or string. |
68
+ | `changeFixedDecimalScale` | Increase or decrease the scale of a fixed decimal. |
69
+
70
+ ### Date utilities (/date)
71
+ | Function | Description |
72
+ | ----------------------------------- | ------------------------------------------------------- |
73
+ | `floorDateToMinutes` | Floor date to the nearest time step (e.g. every 5 min). |
74
+ | `formatDateToString` | Convert a Date to `'YYYY-MM-DD HH:mm:ss'` string. |
75
+ | `secondsToParts` / `partsToSeconds` | Convert between seconds and time components. |
76
+
77
+ ### IP utilities (/ip-addr)
78
+ | Function | Description |
79
+ | ----------------------------- | --------------------------------------------------- |
80
+ | `parseIPv4` / `toIPv4` | Parse or format IPv4 addresses. |
81
+ | `cidrToRange` | Convert a CIDR (e.g. `192.168.0.0/24`) to IP range. |
82
+ | `rangeIPv4` | Generate an iterator of IP addresses in range. |
83
+ | `rangeIPv4ToArr` | Materialize the range as an array. |
84
+ | `ipAddrToNum` / `numToIpAddr` | Convert between IPv4 and integer. |
85
+
86
+ ### Type & Value checkers (/is)
87
+ Simple and strict predicates like isStr, isNum, isObjFilled, isFunc, etc.
88
+
89
+ | Function | Checks if... |
90
+ | ------------------------------------------ | --------------------------------------------- |
91
+ | `isStr`, `isStrFilled` | Value is a string (optionally non-empty). |
92
+ | `isNum`, `isNumP`, `isNumNZ`, `isNumFloat` | Numeric type and positivity/zero constraints. |
93
+ | `isArr`, `isArrFilled` | Array exists and optionally has elements. |
94
+ | `isBool`, `isStrBool` | Boolean or boolean-like string. |
95
+ | `isIpAddr`, `isMacAddr` | Valid network address formats. |
96
+ | `isObj`, `isObjFilled` | Object is plain and not empty. |
97
+ | `isFunc`, `isVar` | Function or valid variable identifier. |
98
+ | `isEmail`, `isPhone`, `isPassword` | Common data validation helpers. |
99
+
100
+ ### Array utilities (/arr)
101
+ | Function | Description |
102
+ | --------------------- | -------------------------------------------------- |
103
+ | `formatStrToFuncArgs` | Convert a comma-separated string to argument list. |
104
+ | `splitArrToPortions` | Split large arrays into chunks of fixed size. |
105
+
106
+ ### String utilities (/str)
107
+ | Function | Description |
108
+ | ----------------------------------- | ---------------------------------------- |
109
+ | `formatToTrim` | Trim string safely. |
110
+ | `formatToLowerCase` | Lowercase string safely. |
111
+ | `formatToPhone` | Normalize to international phone format. |
112
+ | `formatToNull`, `formatToUndefined` | Convert empty strings to null/undefined. |
113
+
114
+ ### Common utilities (/common)
115
+ | Function | Description |
116
+ | -------- | ------------------------------------------------------ |
117
+ | `wait` | Pause execution asynchronously for given milliseconds. |
118
+
119
+ Example:
120
+ ```javascript
121
+ await wait(500); // waits for 0.5 seconds
122
+ ```
123
+
124
+ ### Network utilities (/net)
125
+
126
+ Node-only helpers for TCP connections.
127
+ | Function | Description |
128
+ | -------------------------------- | -------------------------------------------- |
129
+ | `netTCP(message, host, options)` | Send a TCP message and receive the response. |
130
+
131
+ Supports:
132
+ - Timeout controls (timeoutMs, connectTimeoutMs)
133
+ - Safe abort via AbortSignal
134
+ - Line terminator (\n / \r\n)
135
+ - Max bytes and half-close options.
136
+ - Available only in Node.js builds (import from 'full-utils/node')
137
+
138
+ ### URL & Host (/url)
139
+ | Function | Description |
140
+ | ------------- | ---------------------------------------------- |
141
+ | `extractHost` | Extract clean hostname from URL or raw string. |
142
+
143
+ ### JSON utilities (/json)
144
+ | Function | Description |
145
+ | --------------------------- | ------------------------------------------------------- |
146
+ | `jsonEncode` / `jsonDecode` | Safe JSON (de)serialization. |
147
+ | `tryParseJSON` | Try parsing with graceful fallback. |
148
+ | `parseStringLike` | Parse non-strict JSON-like strings (with quotes, etc.). |
149
+
150
+ ### Units (/units)
151
+ | Function | Description |
152
+ | ----------------------- | --------------------------------------------------------------------- |
153
+ | `toH` / `toGH` / `toGB` | Convert numeric values to readable units (hours, gigahash, gigabyte). |
154
+
155
+ ## Importing by environment
156
+ For Node.js:
157
+ ```javascript
158
+ import * from 'full-utils/node';
159
+
160
+ ```
161
+
162
+ For Browser / universal code:
163
+ ```javascript
164
+ import * from 'full-utils/browser';
165
+
166
+ ```
167
+
168
+ Or use tree-shakable imports directly from the source root:
169
+ ```javascript
170
+ import { formatDateToString, isStrFilled } from 'full-utils';
171
+
172
+ ```
173
+
174
+ ## TypeScript Ready
175
+ Every function is strongly typed and documented.
176
+ You’ll get autocompletion, inline JSDoc, and type inference automatically.
177
+
178
+ ## Versioning
179
+ Follows semantic versioning (MAJOR.MINOR.PATCH).
180
+ Breaking changes are always reflected in a major version bump
181
+
182
+ ## License
183
+ Use freely in your own projects. Add proper notices if you publish a package (MIT/Apache-2.0, etc.).
184
+
185
+ ## Summary
186
+
187
+ full-utils gives you many of ready-to-use, predictable, and documented helpers
188
+ that you can safely use in any project, no matter how large or small.
189
+
190
+ One toolkit. Zero dependencies. Full control.
@@ -0,0 +1,3 @@
1
+ 'use strict';function et(t){if(!f(t))return [t];let n=t.trim();if(n==="")return [];if(n.startsWith("[")&&n.endsWith("]")&&(n=n.slice(1,-1).trim(),n===""))return [];let r="",e=false,i=null,o=false,s=0,l=0,d=0,x=[],h=()=>{let u=r.trim();u!==""&&x.push(u),r="";};for(let u=0;u<n.length;u++){let c=n[u];if(e){if(r+=c,o){o=false;continue}if(c==="\\"){o=true;continue}c===i&&(e=false,i=null);continue}if(c==='"'||c==="'"){e=true,i=c,r+=c;continue}if(c==="("){s++,r+=c;continue}if(c===")"){s=Math.max(0,s-1),r+=c;continue}if(c==="["){l++,r+=c;continue}if(c==="]"){l=Math.max(0,l-1),r+=c;continue}if(c==="{"){d++,r+=c;continue}if(c==="}"){d=Math.max(0,d-1),r+=c;continue}if(c===","&&s===0&&l===0&&d===0){h();continue}r+=c;}return r.length&&h(),x.map(u=>{if(u.startsWith("$")&&u.includes("(")&&u.endsWith(")"))return u;if(u==="null")return null;if(u==="undefined")return;if(E(u))return $(u);let c=w(u);if(Number.isFinite(c))return c;if(u==="Infinity")return 1/0;if(u==="-Infinity")return -1/0;let p=String(u||"");if(p.length>=2&&(p.startsWith("'")&&p.endsWith("'")||p.startsWith('"')&&p.endsWith('"')))return p.slice(1,-1).replace(/\\\\/g,"\\").replace(/\\'/g,"'").replace(/\\"/g,'"');if(p.startsWith("{")&&p.endsWith("}")||p.startsWith("[")&&p.endsWith("]"))try{return B(p)}catch{}return p})}function ot(t,n){if(!Number.isInteger(n)||n<=0)return [];let r=[],e=0;for(;e<t.length;)r.push(t.slice(e,e+n)),e+=n;return r}function $(t){switch(true){case F(t):return t;case P(t):return true;case R(t):return false;case(m(t)&&["true","1","yes","on"].includes(String(t??"").trim().toLowerCase())):return true;case(m(t)&&["false","0","no","off"].includes(String(t??"").trim().toLowerCase())):return false}return false}async function ft(t=0){await new Promise(n=>setTimeout(()=>n(true),t));}function mt(t=1,n=new Date){let r=Math.min(60,Math.max(1,Math.trunc(Math.abs(t)))),e=n.getMinutes(),i=Math.floor(e/r)*r,o=new Date(n);return o.setMinutes(i,0,0),o}function pt(t=new Date){let n=d=>String(d).padStart(2,"0"),r=t.getFullYear(),e=n(t.getMonth()+1),i=n(t.getDate()),o=n(t.getHours()),s=n(t.getMinutes()),l=n(t.getSeconds());return `${r}-${e}-${i} ${o}:${s}:${l}`}function gt(t){let{days:n=0,hours:r=0,minutes:e=0,seconds:i=0}=t;return n*86400+r*3600+e*60+i}function xt(t){if(!Number.isFinite(t)||t<0)throw new Error("Invalid total seconds");let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),e=Math.floor(t%3600/60),i=t%60;return {days:n,hours:r,minutes:e,seconds:i}}function M(t){let[n,r]=t.split("/"),e=b(n),i=r?Number(r):NaN;if(e===null||!Number.isInteger(i)||i<0||i>32)return null;let o=i===0?0:4294967295<<32-i>>>0,s=e&o,l=s|~o>>>0;return [N(s),N(l)]}function Tt(t){let n=t.split(".").map(o=>Number(o));if(n.length!==4||n.some(o=>!Number.isInteger(o)||o<0||o>255))throw new Error("Invalid IPv4 address");let r=new ArrayBuffer(4),e=new DataView(r),i=0;for(;i<4;)e.setUint8(i,n[i]),i++;return e.getUint32(0,false)}function yt(t){if(!P(t))return "";let n=new ArrayBuffer(4),r=new DataView(n);r.setUint32(0,t,false);let e=[],i=0;for(;i<4;)e.push(r.getUint8(i)),i++;return e.join(".")}function b(t){if(!f(t))return null;let n=g(t).split(".");if(n.length!==4)return null;let r=0;for(let e=0;e<4;e++){if(!/^\d{1,3}$/.test(n[e]))return null;let i=Number(n[e]);if(i<0||i>255)return null;r=r<<8|i;}return r>>>0}function*j(t,n,r={}){let{includeNetwork:e=true,includeBroadcast:i=true}=r,o,s,l=false,d=null;if(n===void 0&&t.includes("/")){let u=M(t);if(!u)throw new Error(`Invalid CIDR: "${t}"`);let[c,p]=u,[D,V]=t.split("/");d=Number(V),o=b(c),s=b(p),l=true;}else {let u=b(t);if(u===null)throw new Error(`Invalid IPv4: "${t}"`);if(o=u,n&&n.trim()!==""){let c=b(n);if(c===null)throw new Error(`Invalid IPv4: "${n}"`);s=c;}else {let c=o>>>24&255,p=o>>>16&255,D=o>>>8&255;s=(c<<24|p<<16|D<<8|255)>>>0;}}o>s&&([o,s]=[s,o]);let x=-1,h=-1;l&&d!==null&&d<=30&&(x=o,h=s);for(let u=o;u<=s;u=u+1>>>0){if(!e&&u===x){if(u===s)break;continue}if(!i&&u===h){if(u===s)break;continue}if(yield N(u),u===4294967295)break}}function Rt(t,n,r={}){let{limit:e=1e6}=r,i=[],o=0;for(let s of j(t,n,r)){if(o>=e)throw new Error(`Range is too large (> ${e}). Use the generator version instead.`);i.push(s),o++;}return i}function N(t){if(!Number.isInteger(t)||t<0||t>4294967295)throw new Error(`Invalid IPv4 number: ${t}`);return [t>>>24&255,t>>>16&255,t>>>8&255,t&255].join(".")}function k(t){return Array.isArray(t)}function L(t){return k(t)&&t.length>0}function F(t){return typeof t=="boolean"}function Zt(t){if(t instanceof Date)return !Number.isNaN(t.getTime());if(f(t)||a(t)){let n=new Date(t);return !Number.isNaN(n.getTime())}return false}var Q=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z]{2,})+$/;function Gt(t){return m(t)?Q.test(t):false}function Vt(t){return t!=null}function Kt(t){return typeof t=="function"}var K=/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/;function Xt(t){if(!f(t))return false;let n=t.trim();return K.test(n)}function nn(t){return f(t)&&/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(t)}function a(t){return typeof t=="number"&&Number.isFinite(t)}function sn(t){return a(t)&&!Number.isInteger(t)}function fn(t){return a(t)&&t<0}function R(t){return a(t)&&t<=0}function P(t){return a(t)&&t>0}function z(t){return a(t)&&t>=0}function T(t){return typeof t=="object"&&t!==null&&Object.prototype.toString.call(t)==="[object Object]"&&!Array.isArray(t)}function C(t){return T(t)&&Object.keys(t).length>0}function Tn(t,{minLength:n=8,maxLength:r=256,requireUppercase:e=true,requireLowercase:i=true,requireDigit:o=true,requireSpecial:s=true}={}){return !(!f(t)||t.length<n||t.length>r||e&&!/[A-ZА-Я]/.test(t)||i&&!/[a-zа-я]/.test(t)||o&&!/\d/.test(t)||s&&!/[~!?@#$%^&*_\-+()\[\]{}><\\\/|"'.,:;=]/.test(t))}function Fn(t){if(!m(t)&&!a(t))return false;let n=String(t).trim();return !(n.startsWith("-")||(n.match(/\+/g)||[]).length>1||n.includes("+")&&!n.startsWith("+")||!/^\+?[0-9-]+$/.test(n)||n.length<3||n.length>20||!/[0-9]$/.test(n)||n.includes("--"))}function f(t){return typeof t=="string"}function E(t){if(!m(t))return false;let n=t.trim().toLowerCase();return n==="true"||n==="false"}function m(t){return f(t)&&t.trim().length>0}function En(t){if(!m(t))return false;let n=t.trim().toLowerCase();return n==="asc"||n==="desc"}function Mn(t){return f(t)&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)}var q=/^(['"`])([\s\S]*)\1$/;function y(t,n){let r=t.trim(),e=W(r);if(e.ok)return e.value;let i=q.exec(r);return i?i[2]:n?r:null}function W(t){try{return {ok:!0,value:JSON.parse(t)}}catch{}return {ok:false}}function B(t,n=false){if(t===null||a(t)||F(t))return t;if(L(t)){let r=t,e=[];for(let i of r)m(i)?e.push(y(String(i),n)):e.push(i);return e}if(C(t)){let r=t,e={};for(let i of Object.keys(r)){let o=r[i];m(o)?e[i]=y(String(o),n):e[i]=o;}return e}return k(t)||T(t)?t:m(t)?y(String(t),n):null}function Gn(t){try{return T(t)||k(t)?JSON.stringify(t):""}catch{}return ""}function Vn(t,n){let r=Math.trunc(n);if(r===0)return {...t};if(r>0)return {sign:t.sign,digitsInteger:t.digitsInteger,scale:t.scale+r};let e=10n**BigInt(-r);return {sign:t.sign,digitsInteger:t.digitsInteger*e,scale:t.scale+r}}function A(t,n){let r=/^([0-9]+)(?:\.([0-9]*))?e([+\-]?[0-9]+)$/i.exec((()=>{let[o,s]=n.split(/e/i),[l,d=""]=o.split("."),x=l.replace(/^0+/,"")+d,h=parseInt(s,10)-d.length;return `${x||"0"}e${h}`})());if(!r)throw new Error("Failed to parse exponential notation.");let e=r[1],i=parseInt(r[3],10);if(z(i))return e=e+"0".repeat(i),{sign:t,integerPart:e||"0",fractionalPart:""};{let o=-i;if(o>=e.length){let s="0".repeat(o-e.length);return {sign:t,integerPart:"0",fractionalPart:s+e}}else {let s=e.length-o;return {sign:t,integerPart:e.slice(0,s),fractionalPart:e.slice(s)}}}}function J(t){return Number(Z(t))}function Z(t){let n=t.sign<0?"-":"",r=t.digitsInteger.toString();if(t.scale===0)return n+r;let e=t.scale-r.length;if(e>=0)return n+"0."+"0".repeat(e)+r;let i=r.length-t.scale,o=r.slice(0,i),s=r.slice(i);return n+o+"."+s}function w(t,n=1){return J(n>1?U(O(t),n,"half-up"):O(t))}function _(t){if(typeof t=="bigint"){let n=t<0n?-1:1,r=(t<0n?-t:t).toString();return {sign:n,integerPart:r,fractionalPart:""}}if(typeof t=="number"){if(!Number.isFinite(t))throw new Error("Input number is not finite.");let n=t<0?-1:1,e=Math.abs(t).toExponential(30);return A(n,e)}if(typeof t=="string"){let n=t.trim().replace(",",".");if(!n)throw new Error("Input string is empty.");let r=1;if((n.startsWith("+")||n.startsWith("-"))&&(r=n.startsWith("-")?-1:1,n=n.slice(1)),/^[0-9]*\.?[0-9]*(e[+\-]?[0-9]+)?$/i.test(n)){if(/e/i.test(n))return A(r,n);let[e="0",i=""]=n.split(".");return {sign:r,integerPart:e,fractionalPart:i}}throw new Error("Invalid numeric string.")}throw new Error("Unsupported input type.")}function O(t){let{sign:n,integerPart:r,fractionalPart:e}=_(t),i=r.replace(/^0+/,"")||"0",o=e.replace(/0+$/,""),s=i+o||"0";return {sign:n,digitsInteger:BigInt(s),scale:o.length}}function U(t,n,r="half-up"){let e=Math.max(0,Math.trunc(n));if(t.scale<=e)return {...t};let i=t.scale-e,o=10n**BigInt(i),s=t.digitsInteger/o,l=t.digitsInteger%o;if(r==="trunc"||l===0n)return {sign:t.sign,digitsInteger:s,scale:e};let d=o/2n,h=l>=d?s+1n:s;return {sign:t.sign,digitsInteger:h,scale:e}}function cr(t){if(!f(t))return "";let n=g(t);return m(n)?n.toLowerCase():""}function lr(t){return f(t)&&g(t)===""||t===void 0?null:t}function gr(t,n="+7"){if(!f(t))return null;let r=g(t).replace(/[\s\-().]/g,"");return /^00\d{8,15}$/.test(r)?r="+"+r.slice(2):/^\d{10}$/.test(r)?r=n+r:/^\d{9,15}$/.test(r)&&!r.startsWith("0")&&(r="+"+r),/^\+\d{10,15}$/.test(r)?r:null}function g(t){return String(f(t)?t.trim().normalize("NFKC").replace(/[\u200B-\u200D\uFEFF]/g,""):"")}function Tr(t){return f(t)&&g(t)===""||t===null?void 0:t}var Y=1024,G=Y*1024,S=G*1024,H=S*1024,X=H*1024;function Fr(t,n=""){let r=w(t);if(!a(r))throw new Error(`toGB: value "${t}" is not numeric`);let e=String(n).trim().toLowerCase().replace(/\s+/g,""),i=e?e[0]:"g",o;switch(i){case "b":o=r/S;break;case "k":o=r/G;break;case "m":o=r/S;break;case "g":o=r;break;case "t":o=r*(H/S);break;case "p":o=r*(X/S);break;default:o=r;break}if(!a(o))throw new Error(`toGB: result is not finite (value="${t}", unit="${n}")`);return Object.is(o,-0)?0:o}function I(t){return String(t).trim().toLowerCase().replace(/\s+/g,"").replace(/(?:\/?s|hash(?:es)?)$/i,"")}var v={h:1e-9,k:1e-6,m:.001,g:1,t:1e3,p:1e6,e:1e9};function Ar(t,n=""){let r=w(t);if(!a(r))return 0;let e=I(n),i=e?e[0]:"g",o=v[i]??1,s=r*o;if(!a(s))throw new Error(`toGH: result is not finite (value="${r}", unit="${e}")`);return Object.is(s,-0)?0:s}var tt={h:1,k:1e3,m:1e6,g:1e9,t:1e12,p:1e15,e:1e18};function Br(t,n=""){let r=w(t);if(!a(r))return 0;let e=I(n),i=e?e[0]:"h",o=tt[i]??1,s=r*o;if(!a(s))throw new Error(`toH: result is not finite (value="${r}", unit="${e}")`);return Object.is(s,-0)?0:s}var nt=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function jr(t=""){if(!m(t))return "";let n=t.trim(),r=nt.test(n)?n:`http://${n}`;try{return new URL(r).hostname}catch{let i=(n.split("@").pop()||n).split(/[/?#]/,1)[0],o=i.match(/^\[([^\]]+)\]/);return o?o[1]:i.split(":",1)[0]||""}}
2
+ exports.changeFixedDecimalScale=Vn;exports.cidrToRange=M;exports.convertExponentialToParts=A;exports.extractHost=jr;exports.fixedDecimalToNum=J;exports.fixedDecimalToStr=Z;exports.floorDateToMinutes=mt;exports.formatDateToString=pt;exports.formatStrToFuncArgs=et;exports.formatToBool=$;exports.formatToLowerCase=cr;exports.formatToNull=lr;exports.formatToNum=w;exports.formatToPhone=gr;exports.formatToTrim=g;exports.formatToUndefined=Tr;exports.ipAddrToNum=Tt;exports.isArr=k;exports.isArrFilled=L;exports.isBool=F;exports.isDate=Zt;exports.isEmail=Gt;exports.isExists=Vt;exports.isFunc=Kt;exports.isIpAddr=Xt;exports.isMacAddr=nn;exports.isNum=a;exports.isNumFloat=sn;exports.isNumN=fn;exports.isNumNZ=R;exports.isNumP=P;exports.isNumPZ=z;exports.isObj=T;exports.isObjFilled=C;exports.isPassword=Tn;exports.isPhone=Fn;exports.isStr=f;exports.isStrAscDesc=En;exports.isStrBool=E;exports.isStrFilled=m;exports.isVar=Mn;exports.jsonDecode=B;exports.jsonEncode=Gn;exports.normalizeToDecimalComponents=_;exports.numToIpAddr=yt;exports.parseIPv4=b;exports.parseStringLike=y;exports.parseToFixedDecimal=O;exports.partsToSeconds=gt;exports.rangeIPv4=j;exports.rangeIPv4ToArr=Rt;exports.roundFixedDecimal=U;exports.secondsToParts=xt;exports.splitArrToPortions=ot;exports.toGB=Fr;exports.toGH=Ar;exports.toH=Br;exports.toIPv4=N;exports.tryParseJSON=W;exports.wait=ft;//# sourceMappingURL=browser.cjs.map
3
+ //# sourceMappingURL=browser.cjs.map