@develia/commons 0.4.13 → 0.4.15

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 (223) hide show
  1. package/dist/cjs/array.js +27 -1
  2. package/dist/cjs/array.js.map +1 -1
  3. package/dist/cjs/async-pool-executor.js +15 -0
  4. package/dist/cjs/async-pool-executor.js.map +1 -1
  5. package/dist/cjs/browser/form-utilities.js +33 -6
  6. package/dist/cjs/browser/form-utilities.js.map +1 -1
  7. package/dist/cjs/browser/geo-location.js +5 -0
  8. package/dist/cjs/browser/geo-location.js.map +1 -1
  9. package/dist/cjs/browser/index.js.map +1 -1
  10. package/dist/cjs/browser/native-bridge.js +9 -0
  11. package/dist/cjs/browser/native-bridge.js.map +1 -1
  12. package/dist/cjs/cancellable-promise.js.map +1 -1
  13. package/dist/cjs/clean-url-search-params.js +1 -0
  14. package/dist/cjs/clean-url-search-params.js.map +1 -1
  15. package/dist/cjs/collections/cache-dictionary.js +39 -0
  16. package/dist/cjs/collections/cache-dictionary.js.map +1 -1
  17. package/dist/cjs/collections/default-map.js +25 -1
  18. package/dist/cjs/collections/default-map.js.map +1 -1
  19. package/dist/cjs/collections/default-weak-map.js +23 -3
  20. package/dist/cjs/collections/default-weak-map.js.map +1 -1
  21. package/dist/cjs/{from.js → collections/from.js} +278 -4
  22. package/dist/cjs/collections/from.js.map +1 -0
  23. package/dist/cjs/collections/index.js +3 -1
  24. package/dist/cjs/collections/index.js.map +1 -1
  25. package/dist/cjs/draft.js +43 -2
  26. package/dist/cjs/draft.js.map +1 -1
  27. package/dist/cjs/event-bus.js +1 -0
  28. package/dist/cjs/event-bus.js.map +1 -1
  29. package/dist/cjs/index.js +14 -3
  30. package/dist/cjs/index.js.map +1 -1
  31. package/dist/cjs/key-value-pair.js +6 -0
  32. package/dist/cjs/key-value-pair.js.map +1 -1
  33. package/dist/cjs/lazy.js +4 -0
  34. package/dist/cjs/lazy.js.map +1 -1
  35. package/dist/cjs/math.js +19 -0
  36. package/dist/cjs/math.js.map +1 -1
  37. package/dist/cjs/order.js.map +1 -1
  38. package/dist/cjs/parse.js +96 -0
  39. package/dist/cjs/parse.js.map +1 -1
  40. package/dist/cjs/patch.js +10 -2
  41. package/dist/cjs/patch.js.map +1 -1
  42. package/dist/cjs/stopwatch.js +10 -0
  43. package/dist/cjs/stopwatch.js.map +1 -1
  44. package/dist/cjs/string.js +62 -0
  45. package/dist/cjs/string.js.map +1 -1
  46. package/dist/cjs/timer.js +7 -0
  47. package/dist/cjs/timer.js.map +1 -1
  48. package/dist/cjs/timespan.js +202 -0
  49. package/dist/cjs/timespan.js.map +1 -1
  50. package/dist/cjs/type-code.js.map +1 -1
  51. package/dist/cjs/type.js +80 -1
  52. package/dist/cjs/type.js.map +1 -1
  53. package/dist/cjs/types.js.map +1 -1
  54. package/dist/cjs/utilities.js +213 -7
  55. package/dist/cjs/utilities.js.map +1 -1
  56. package/dist/esm/array.js +27 -1
  57. package/dist/esm/array.js.map +1 -1
  58. package/dist/esm/async-pool-executor.js +15 -0
  59. package/dist/esm/async-pool-executor.js.map +1 -1
  60. package/dist/esm/browser/form-utilities.js +33 -6
  61. package/dist/esm/browser/form-utilities.js.map +1 -1
  62. package/dist/esm/browser/geo-location.js +5 -0
  63. package/dist/esm/browser/geo-location.js.map +1 -1
  64. package/dist/esm/browser/index.js.map +1 -1
  65. package/dist/esm/browser/native-bridge.js +9 -0
  66. package/dist/esm/browser/native-bridge.js.map +1 -1
  67. package/dist/esm/cancellable-promise.js.map +1 -1
  68. package/dist/esm/clean-url-search-params.js +1 -0
  69. package/dist/esm/clean-url-search-params.js.map +1 -1
  70. package/dist/esm/collections/cache-dictionary.js +39 -0
  71. package/dist/esm/collections/cache-dictionary.js.map +1 -1
  72. package/dist/esm/collections/default-map.js +25 -1
  73. package/dist/esm/collections/default-map.js.map +1 -1
  74. package/dist/esm/collections/default-weak-map.js +22 -2
  75. package/dist/esm/collections/default-weak-map.js.map +1 -1
  76. package/dist/esm/{from.js → collections/from.js} +278 -4
  77. package/dist/esm/collections/from.js.map +1 -0
  78. package/dist/esm/collections/index.js +1 -0
  79. package/dist/esm/collections/index.js.map +1 -1
  80. package/dist/esm/draft.js +43 -2
  81. package/dist/esm/draft.js.map +1 -1
  82. package/dist/esm/event-bus.js +1 -0
  83. package/dist/esm/event-bus.js.map +1 -1
  84. package/dist/esm/index.js +13 -1
  85. package/dist/esm/index.js.map +1 -1
  86. package/dist/esm/key-value-pair.js +6 -0
  87. package/dist/esm/key-value-pair.js.map +1 -1
  88. package/dist/esm/lazy.js +4 -0
  89. package/dist/esm/lazy.js.map +1 -1
  90. package/dist/esm/math.js +19 -0
  91. package/dist/esm/math.js.map +1 -1
  92. package/dist/esm/order.js.map +1 -1
  93. package/dist/esm/parse.js +96 -0
  94. package/dist/esm/parse.js.map +1 -1
  95. package/dist/esm/patch.js +10 -2
  96. package/dist/esm/patch.js.map +1 -1
  97. package/dist/esm/stopwatch.js +10 -0
  98. package/dist/esm/stopwatch.js.map +1 -1
  99. package/dist/esm/string.js +62 -0
  100. package/dist/esm/string.js.map +1 -1
  101. package/dist/esm/timer.js +7 -0
  102. package/dist/esm/timer.js.map +1 -1
  103. package/dist/esm/timespan.js +202 -0
  104. package/dist/esm/timespan.js.map +1 -1
  105. package/dist/esm/type-code.js.map +1 -1
  106. package/dist/esm/type.js +80 -1
  107. package/dist/esm/type.js.map +1 -1
  108. package/dist/esm/types.js.map +1 -1
  109. package/dist/esm/utilities.js +212 -7
  110. package/dist/esm/utilities.js.map +1 -1
  111. package/dist/types/array.d.ts +26 -0
  112. package/dist/types/array.d.ts.map +1 -1
  113. package/dist/types/async-pool-executor.d.ts +15 -0
  114. package/dist/types/async-pool-executor.d.ts.map +1 -1
  115. package/dist/types/browser/form-utilities.d.ts +13 -0
  116. package/dist/types/browser/form-utilities.d.ts.map +1 -1
  117. package/dist/types/browser/index.d.ts.map +1 -1
  118. package/dist/types/browser/native-bridge.d.ts +6 -0
  119. package/dist/types/browser/native-bridge.d.ts.map +1 -1
  120. package/dist/types/collections/cache-dictionary.d.ts +39 -0
  121. package/dist/types/collections/cache-dictionary.d.ts.map +1 -1
  122. package/dist/types/collections/default-map.d.ts +23 -0
  123. package/dist/types/collections/default-map.d.ts.map +1 -1
  124. package/dist/types/collections/default-weak-map.d.ts +20 -1
  125. package/dist/types/collections/default-weak-map.d.ts.map +1 -1
  126. package/dist/types/collections/from.d.ts +333 -0
  127. package/dist/types/collections/from.d.ts.map +1 -0
  128. package/dist/types/collections/index.d.ts +1 -0
  129. package/dist/types/collections/index.d.ts.map +1 -1
  130. package/dist/types/draft.d.ts +68 -0
  131. package/dist/types/draft.d.ts.map +1 -1
  132. package/dist/types/index.d.ts +4 -1
  133. package/dist/types/index.d.ts.map +1 -1
  134. package/dist/types/key-value-pair.d.ts +6 -0
  135. package/dist/types/key-value-pair.d.ts.map +1 -1
  136. package/dist/types/lazy.d.ts +4 -0
  137. package/dist/types/lazy.d.ts.map +1 -1
  138. package/dist/types/math.d.ts +19 -0
  139. package/dist/types/math.d.ts.map +1 -1
  140. package/dist/types/parse.d.ts +121 -0
  141. package/dist/types/parse.d.ts.map +1 -1
  142. package/dist/types/string.d.ts +51 -0
  143. package/dist/types/string.d.ts.map +1 -1
  144. package/dist/types/timer.d.ts +7 -0
  145. package/dist/types/timer.d.ts.map +1 -1
  146. package/dist/types/timespan.d.ts +202 -0
  147. package/dist/types/timespan.d.ts.map +1 -1
  148. package/dist/types/type.d.ts +40 -0
  149. package/dist/types/type.d.ts.map +1 -1
  150. package/dist/types/utilities.d.ts +174 -2
  151. package/dist/types/utilities.d.ts.map +1 -1
  152. package/dist/web/array.js +27 -1
  153. package/dist/web/array.js.map +1 -1
  154. package/dist/web/async-pool-executor.js +15 -0
  155. package/dist/web/async-pool-executor.js.map +1 -1
  156. package/dist/web/browser/form-utilities.js +33 -6
  157. package/dist/web/browser/form-utilities.js.map +1 -1
  158. package/dist/web/browser/geo-location.js +5 -0
  159. package/dist/web/browser/geo-location.js.map +1 -1
  160. package/dist/web/browser/index.js.map +1 -1
  161. package/dist/web/browser/native-bridge.js +9 -0
  162. package/dist/web/browser/native-bridge.js.map +1 -1
  163. package/dist/web/cancellable-promise.js.map +1 -1
  164. package/dist/web/clean-url-search-params.js +1 -0
  165. package/dist/web/clean-url-search-params.js.map +1 -1
  166. package/dist/web/collections/cache-dictionary.js +39 -0
  167. package/dist/web/collections/cache-dictionary.js.map +1 -1
  168. package/dist/web/collections/default-map.js +25 -1
  169. package/dist/web/collections/default-map.js.map +1 -1
  170. package/dist/web/collections/default-weak-map.js +22 -2
  171. package/dist/web/collections/default-weak-map.js.map +1 -1
  172. package/dist/web/{from.js → collections/from.js} +279 -5
  173. package/dist/web/collections/from.js.map +1 -0
  174. package/dist/web/collections/index.js +1 -0
  175. package/dist/web/collections/index.js.map +1 -1
  176. package/dist/web/draft.js +43 -2
  177. package/dist/web/draft.js.map +1 -1
  178. package/dist/web/event-bus.js +1 -0
  179. package/dist/web/event-bus.js.map +1 -1
  180. package/dist/web/index.js +13 -1
  181. package/dist/web/index.js.map +1 -1
  182. package/dist/web/key-value-pair.js +6 -0
  183. package/dist/web/key-value-pair.js.map +1 -1
  184. package/dist/web/lazy.js +4 -0
  185. package/dist/web/lazy.js.map +1 -1
  186. package/dist/web/math.js +19 -0
  187. package/dist/web/math.js.map +1 -1
  188. package/dist/web/order.js.map +1 -1
  189. package/dist/web/parse.js +96 -0
  190. package/dist/web/parse.js.map +1 -1
  191. package/dist/web/patch.js +10 -2
  192. package/dist/web/patch.js.map +1 -1
  193. package/dist/web/stopwatch.js +10 -0
  194. package/dist/web/stopwatch.js.map +1 -1
  195. package/dist/web/string.js +62 -0
  196. package/dist/web/string.js.map +1 -1
  197. package/dist/web/timer.js +7 -0
  198. package/dist/web/timer.js.map +1 -1
  199. package/dist/web/timespan.js +202 -0
  200. package/dist/web/timespan.js.map +1 -1
  201. package/dist/web/type-code.js.map +1 -1
  202. package/dist/web/type.js +80 -1
  203. package/dist/web/type.js.map +1 -1
  204. package/dist/web/types.js.map +1 -1
  205. package/dist/web/utilities.js +212 -7
  206. package/dist/web/utilities.js.map +1 -1
  207. package/package.json +1 -1
  208. package/src/browser/form-utilities.ts +7 -6
  209. package/src/browser/index.ts +2 -2
  210. package/src/collections/cache-dictionary.ts +39 -1
  211. package/src/collections/default-map.ts +15 -9
  212. package/src/collections/default-weak-map.ts +14 -12
  213. package/src/{from.ts → collections/from.ts} +285 -15
  214. package/src/collections/index.ts +4 -3
  215. package/src/draft.ts +6 -2
  216. package/src/index.ts +1 -1
  217. package/src/timespan.ts +199 -20
  218. package/src/utilities.ts +53 -9
  219. package/dist/cjs/from.js.map +0 -1
  220. package/dist/esm/from.js.map +0 -1
  221. package/dist/types/from.d.ts +0 -59
  222. package/dist/types/from.d.ts.map +0 -1
  223. package/dist/web/from.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.js","sourceRoot":"","sources":["../../src/utilities.ts"],"names":[],"mappings":"AAGA,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAE/C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,IAAI,CAAmB,OAAgB;IACnD,IAAI,QAAQ,GAAa,IAAI,CAAC;IAE9B,MAAM,WAAW,GAAG,GAAM,EAAE;QACxB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,QAAQ,GAAG,OAAO,EAAE,CAAC;QACzB,CAAC;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO,IAAI,KAAK,CAAC,EAAO,EAAE;QACtB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ;YACjB,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QACtD,CAAC;QACD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ;YACxB,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,E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I,GAAQ,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAClC,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;IAElD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAEpB,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACrC,IAAI,CAAC,GAAG,CAAC,GAAG,UAAU,CAAE,KAAa,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,IAAS,CAAC;AACrB,CAAC;AAGD;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,KAAU;IAE9B,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["// noinspection JSUnusedGlobalSymbols\r\n\r\n\r\nimport KeyValuePair from \"./key-value-pair.js\";\r\nimport type {Resolvable} from \"./types.js\";\r\nimport Type from \"./type.js\";\r\n\r\nexport function lazy<T extends object>(factory: () => T): T {\r\n let instance: T | null = null;\r\n\r\n const getInstance = (): T => {\r\n if (!instance) {\r\n instance = factory();\r\n }\r\n return instance;\r\n };\r\n\r\n return new Proxy({} as T, {\r\n get(_, prop, receiver) {\r\n return Reflect.get(getInstance(), prop, receiver);\r\n },\r\n set(_, prop, value, receiver) {\r\n return Reflect.set(getInstance(), prop, value, receiver);\r\n },\r\n has(_, prop) {\r\n return Reflect.has(getInstance(), prop);\r\n },\r\n deleteProperty(_, prop) {\r\n return Reflect.deleteProperty(getInstance(), prop);\r\n },\r\n ownKeys() {\r\n return Reflect.ownKeys(getInstance());\r\n },\r\n getOwnPropertyDescriptor(_, prop) {\r\n return Reflect.getOwnPropertyDescriptor(getInstance(), prop);\r\n },\r\n getPrototypeOf() {\r\n return Reflect.getPrototypeOf(getInstance());\r\n },\r\n });\r\n}\r\n\r\n/**\r\n * Checks if an object is iterable.\r\n *\r\n * @param {any} obj - The object to check.\r\n * @return {boolean} - Returns true if the object is iterable, otherwise false.\r\n */\r\nexport function isIterable(obj: any): boolean {\r\n return obj[Symbol.iterator] === 'function';\r\n}\r\n\r\n/**\r\n * Checks if a given value is a string.\r\n *\r\n * @param {*} value - The value to check.\r\n * @return {boolean} - Returns true if the value is a string, otherwise returns false.\r\n */\r\nexport function isString(value: any): value is string {\r\n return typeof value === 'string';\r\n}\r\n\r\n/**\r\n * Checks if a value is a number.\r\n *\r\n * @param {any} value - The value to check.\r\n * @return {boolean} - Returns true if the value is a number, otherwise false.\r\n */\r\nexport function isNumber(value: any): value is number {\r\n return typeof value === 'number';\r\n}\r\n\r\n/**\r\n * Checks if a given value is a boolean.\r\n *\r\n * @param {any} value - The value to be checked.\r\n *\r\n * @return {boolean} - Returns true if the value is a boolean, otherwise false.\r\n */\r\nexport function isBoolean(value: any): value is boolean {\r\n return typeof value === 'boolean';\r\n}\r\n\r\n/**\r\n * Checks if a value is an object.\r\n * @param {any} value - The value to be checked.\r\n * @returns {boolean} - Returns true if the value is an object, otherwise returns false.\r\n */\r\nexport function isObject(value: any): value is object {\r\n return value != null && typeof value === 'object' && !Array.isArray(value);\r\n}\r\n\r\n/**\r\n * Determines if a value is an array.\r\n *\r\n * @param value - The value to be checked.\r\n *\r\n * @return Whether the value is an array.\r\n */\r\nexport function isArray(value: any): value is any[] {\r\n return Array.isArray(value);\r\n}\r\n\r\n/**\r\n * Checks if a value is a function.\r\n *\r\n * @param {any} value - The value to be checked.\r\n * @return {boolean} - Returns true if the value is a function, otherwise returns false.\r\n */\r\nexport function isFunction(value: any): value is Function {\r\n return typeof value === 'function';\r\n}\r\n\r\n\r\n/**\r\n * Structural deep equality check.\r\n *\r\n * Compares primitives by value, and objects/arrays/Maps/Sets/Dates/RegExps\r\n * by structure. Handles circular references.\r\n *\r\n * @param a - First value.\r\n * @param b - Second value.\r\n * @returns `true` if `a` and `b` are structurally equal.\r\n */\r\nexport function deepEqual(a: unknown, b: unknown): boolean {\r\n return _deepEqual(a, b);\r\n}\r\n\r\n/**\r\n * Internal implementation of deep equality check.\r\n * @param a - First value.\r\n * @param b - Second value.\r\n * @param seen - Internal map used to handle circular references.\r\n */\r\nfunction _deepEqual(\r\n a: unknown,\r\n b: unknown,\r\n seen: WeakMap<object, unknown> = new WeakMap()\r\n): boolean {\r\n if (a === b) return true;\r\n if (a === null || b === null) return false;\r\n if (typeof a !== typeof b) return false;\r\n if (typeof a !== \"object\") return false;\r\n\r\n const objA = a as object;\r\n if (seen.has(objA)) return seen.get(objA) === b;\r\n seen.set(objA, b);\r\n\r\n if (a instanceof Date) return b instanceof Date && a.getTime() === b.getTime();\r\n if (a instanceof RegExp) return b instanceof RegExp && a.toString() === b.toString();\r\n if (Array.isArray(a) !== Array.isArray(b)) return false;\r\n\r\n if (a instanceof Map) {\r\n if (!(b instanceof Map) || a.size !== b.size) return false;\r\n for (const [k, v] of a) {\r\n if (!b.has(k) || !_deepEqual(v, b.get(k), seen)) return false;\r\n }\r\n return true;\r\n }\r\n\r\n if (a instanceof Set) {\r\n if (!(b instanceof Set) || a.size !== b.size) return false;\r\n for (const v of a) if (!b.has(v)) return false;\r\n return true;\r\n }\r\n\r\n const keysA = Reflect.ownKeys(a as object);\r\n const keysB = Reflect.ownKeys(b as object);\r\n if (keysA.length !== keysB.length) return false;\r\n\r\n for (const key of keysA) {\r\n if (!Object.prototype.hasOwnProperty.call(b, key)) return false;\r\n if (!_deepEqual((a as any)[key], (b as any)[key], seen)) return false;\r\n }\r\n\r\n return true;\r\n}\r\n\r\n\r\n/**\r\n * Submits an HTML form programmatically using the specified HTTP method (default is POST),\r\n * without using AJAX. Supports nested objects and arrays using bracket notation (e.g., `user[name]`, `tags[]`).\r\n *\r\n * @param url - The destination URL where the form will be submitted.\r\n * @param data - An object containing key-value pairs. Supports nested structures and arrays.\r\n * @param method - HTTP method to use: 'POST' or 'GET' (default: 'POST').\r\n * @param target - Optional parameter specifying the target for the form submission (e.g., '_blank', '_self', '_parent', '_top').\r\n */\r\n\r\n\r\n/**\r\n * Compares two objects or arrays to check if they have the same immediate fields and values,\r\n * or the same immediate elements if they are arrays (shallow equality check).\r\n *\r\n * @param {any} a - The first object or array.\r\n * @param {any} b - The second object or array.\r\n * @return {boolean} - Returns true if the objects/arrays are shallowly equal, otherwise false.\r\n */\r\nexport function shallowEqual(a: any, b: any): boolean {\r\n if (a === b) {\r\n return true;\r\n }\r\n\r\n if (a === null || b === null || typeof a !== typeof b) {\r\n return false;\r\n }\r\n\r\n if (Array.isArray(a) && Array.isArray(b)) {\r\n if (a.length !== b.length) {\r\n return false;\r\n }\r\n return a.every((value, index) => value === b[index]);\r\n }\r\n\r\n if (typeof a === \"object\" && typeof b === \"object\") {\r\n const keysA = Object.keys(a);\r\n const keysB = Object.keys(b);\r\n\r\n if (keysA.length !== keysB.length) {\r\n return false;\r\n }\r\n return keysA.every(key => b.hasOwnProperty(key) && a[key] === b[key]);\r\n }\r\n\r\n return false;\r\n}\r\n\r\n\r\n/**\r\n * Pauses the execution of an asynchronous function for a specified duration.\r\n *\r\n * @param {number} ms - The delay duration in milliseconds.\r\n * @return {Promise<void>} A promise that resolves after the specified delay.\r\n */\r\nexport async function delay(ms: number): Promise<void> {\r\n await new Promise(resolve => setTimeout(resolve, ms));\r\n}\r\n\r\n/**\r\n * Checks if a value is undefined.\r\n *\r\n * @param {any} value - The value to check.\r\n * @returns {boolean} - True if the value is undefined, false otherwise.\r\n */\r\nexport function isUndefined(value: any): value is undefined {\r\n return typeof value === 'undefined';\r\n}\r\n\r\n/**\r\n * Checks if a value is defined or not.\r\n *\r\n * @param {any} value - The value to be checked.\r\n *\r\n * @return {boolean} - True if the value is defined, false otherwise.\r\n */\r\nexport function isDefined(value: any): value is undefined {\r\n return typeof value !== 'undefined';\r\n}\r\n\r\n/**\r\n * Checks if a given value is null.\r\n *\r\n * @param {any} value - The value to check for null.\r\n * @return {boolean} - Returns true if the value is null, otherwise returns false.\r\n */\r\nexport function isNull(value: any): value is null {\r\n return value === null;\r\n}\r\n\r\n\r\n/**\r\n * Determines whether the given value is of type bigint.\r\n * @param {any} value - The value to be checked.\r\n * @return {boolean} - Returns true if the value is of type bigint, false otherwise.\r\n */\r\nexport function isBigInt(value: any): value is bigint {\r\n return typeof value === 'bigint';\r\n}\r\n\r\n/**\r\n * Checks if a given value is a symbol.\r\n *\r\n * @param {any} value - The value to be checked.\r\n * @return {boolean} - Returns true if the value is a symbol, false otherwise.\r\n */\r\nexport function isSymbol(value: any): value is symbol {\r\n return typeof value === 'symbol';\r\n}\r\n\r\n/**\r\n * Checks if a value is null or undefined.\r\n *\r\n * @param {any} value - The value to check.\r\n * @return {boolean} - Returns true if the value is null or undefined, false otherwise.\r\n * @deprecated\r\n */\r\nexport function isNullOrUndefined(value: any): boolean {\r\n return value === null || typeof value === 'undefined';\r\n}\r\n\r\n/**\r\n * Checks if a value is null or undefined.\r\n *\r\n * @param {any} value - The value to check.\r\n * @return {boolean} - Returns true if the value is null or undefined, false otherwise.\r\n\r\n */\r\nexport function isNullish(value: any): boolean {\r\n return value === null || typeof value === 'undefined';\r\n}\r\n\r\n/**\r\n * Checks if a given value is empty.\r\n *\r\n * @param {any} value - The value to check.\r\n * @return {boolean} - Returns true if the value is empty, otherwise returns false.\r\n */\r\nexport function isEmpty(value: any): boolean {\r\n return (Array.isArray(value) && value.length === 0) ||\r\n (typeof value === 'string' && value === '') ||\r\n value === null || typeof value === 'undefined';\r\n}\r\n\r\n/**\r\n * Check if a value is empty or contains only whitespace characters.\r\n *\r\n * @param {any} value - The value to check.\r\n * @return {boolean} Returns true if the value is empty or contains only whitespace characters, otherwise returns false.\r\n */\r\nexport function isEmptyOrWhitespace(value: any): boolean {\r\n return (Array.isArray(value) && value.length === 0) ||\r\n (typeof value === 'string' && value.trim() === '') ||\r\n value === null || typeof value === 'undefined';\r\n}\r\n\r\n\r\n/**\r\n * Converts an object into an array of key-value pairs.\r\n *\r\n * @param {Record<string, any>} obj - The object to convert.\r\n * @return {KeyValuePair<string, any>[]} - The array of key-value pairs.\r\n */\r\nexport function toPairs(obj: Record<string, any>): KeyValuePair<string, any>[] {\r\n\r\n let output = [];\r\n for (const key in obj) {\r\n output.push(new KeyValuePair(key, obj[key]));\r\n }\r\n return output;\r\n\r\n}\r\n\r\n/**\r\n * Creates an object composed of the picked object properties.\r\n *\r\n * @template T - The type of the source object.\r\n * @template K - The type of the keys to pick.\r\n * @param obj - The source object.\r\n * @param props - The property names to pick.\r\n * @returns A new object with the picked properties.\r\n */\r\nexport function pick<T extends object, K extends keyof T>(obj: T, props: K[]): Pick<T, K> {\r\n const result = {} as Pick<T, K>;\r\n if (obj === null || typeof obj !== 'object') {\r\n return result;\r\n }\r\n\r\n for (const key of props) {\r\n if (key in obj) {\r\n result[key] = obj[key];\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Converts a given thing into a Promise.\r\n * @template T\r\n * @param {any} thing - The thing to be converted into a Promise.\r\n * @returns {Promise<T>} - A Promise representing the given thing.\r\n */\r\nexport function promisify<T>(thing: Resolvable<T>): Promise<T> {\r\n\r\n if (thing instanceof Promise)\r\n return thing;\r\n\r\n\r\n if (isFunction(thing)) {\r\n return new Promise<T>((resolve, reject) => {\r\n try {\r\n const result = thing();\r\n resolve(result);\r\n } catch (error) {\r\n reject(error);\r\n }\r\n });\r\n }\r\n\r\n return Promise.resolve(thing);\r\n}\r\n\r\n\r\n/**\r\n * Create a deep, independent copy of a value.\r\n *\r\n * Supports primitives, plain objects, arrays, `Date`, `RegExp`, `Map`, `Set`,\r\n * symbol-keyed properties and circular references. Functions are copied by\r\n * reference. Class instances preserve their prototype.\r\n *\r\n * @template T - The value's type.\r\n * @param value - The value to clone.\r\n * @returns A deep clone of `value`.\r\n */\r\nexport function deepClone<T>(value: T): T {\r\n return _deepClone(value);\r\n}\r\n\r\n/**\r\n * Internal implementation of deep clone.\r\n * @param value - The value to clone.\r\n * @param seen - Internal map used to handle circular references.\r\n */\r\nfunction _deepClone<T>(\r\n value: T,\r\n seen: WeakMap<object, unknown> = new WeakMap()\r\n): T {\r\n if (value === null || typeof value !== \"object\") return value;\r\n\r\n const obj = value as unknown as object;\r\n if (seen.has(obj)) return seen.get(obj) as T;\r\n\r\n if (value instanceof Date) return new Date(value) as T;\r\n if (value instanceof RegExp) return new RegExp(value) as T;\r\n\r\n if (value instanceof Map) {\r\n const copy = new Map();\r\n seen.set(value, copy);\r\n for (const [k, v] of value) {\r\n copy.set(_deepClone(k, seen), _deepClone(v, seen));\r\n }\r\n return copy as T;\r\n }\r\n\r\n if (value instanceof Set) {\r\n const copy = new Set();\r\n seen.set(value, copy);\r\n for (const v of value) {\r\n copy.add(_deepClone(v, seen));\r\n }\r\n return copy as T;\r\n }\r\n\r\n const copy: any = Array.isArray(value)\r\n ? []\r\n : Object.create(Object.getPrototypeOf(value));\r\n\r\n seen.set(obj, copy);\r\n\r\n for (const key of Reflect.ownKeys(obj)) {\r\n copy[key] = _deepClone((value as any)[key], seen);\r\n }\r\n\r\n return copy as T;\r\n}\r\n\r\n\r\n/**\r\n * Returns the type of the given value.\r\n *\r\n * @param {any} value - The value to determine the type of.\r\n * @return {Type} - The type of the given value.\r\n * @deprecated use Type.of(...)\r\n */\r\nexport function getType(value: any): Type {\r\n\r\n return Type.of(value);\r\n}\r\n\r\n\r\n\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develia/commons",
3
- "version": "0.4.13",
3
+ "version": "0.4.15",
4
4
  "author": {
5
5
  "name": "Antonio Gil Espinosa",
6
6
  "email": "antonio.gil.espinosa@gmail.com",
@@ -53,9 +53,9 @@ export function submitForm(
53
53
  */
54
54
  const appendInputs = (keyPrefix: string, value: any) => {
55
55
  if (Array.isArray(value)) {
56
- value.forEach(val => {
56
+ for (const val of value) {
57
57
  appendInputs(`${keyPrefix}[]`, val);
58
- });
58
+ }
59
59
  } else if (typeof value === 'object' && value !== null) {
60
60
  for (const subKey in value) {
61
61
  if (value.hasOwnProperty(subKey)) {
@@ -122,14 +122,15 @@ function _objectToFormData(data: Record<string, any>, formData: FormData, parent
122
122
  } else if (typeof value === 'object' && !Array.isArray(value)) {
123
123
  _objectToFormData(value, formData, parentKey ? `${parentKey}[${key}]` : key);
124
124
  } else if (Array.isArray(value)) {
125
- value.forEach((item, index) => {
125
+ for (let index = 0; index < value.length; index++) {
126
+ const item = value[index];
126
127
  const arrayKey = `${parentKey ? `${parentKey}[${key}]` : key}[${index}]`;
127
128
  if (typeof item === 'object' && !Array.isArray(item)) {
128
129
  _objectToFormData(item, formData, arrayKey);
129
130
  } else {
130
131
  formData.append(arrayKey, item);
131
132
  }
132
- });
133
+ }
133
134
  } else {
134
135
  formData.append(parentKey ? `${parentKey}[${key}]` : key, value);
135
136
  }
@@ -161,7 +162,7 @@ export function ajaxSubmission(
161
162
  .filter(el => el instanceof HTMLFormElement) as HTMLFormElement[]
162
163
  : [selectorOrElement];
163
164
 
164
- forms.forEach(form => {
165
+ for (const form of forms) {
165
166
  form.addEventListener('submit', async (event) => {
166
167
  event.preventDefault();
167
168
 
@@ -176,5 +177,5 @@ export function ajaxSubmission(
176
177
 
177
178
 
178
179
  });
179
- });
180
+ }
180
181
  }
@@ -109,8 +109,8 @@ export async function fetchInto(
109
109
  return replacedCount;
110
110
  }
111
111
 
112
- export * from './form-utilities.js'
112
+ export * from './form-utilities.js';
113
113
 
114
- export {default as NativeBridge} from "./native-bridge.js"
114
+ export {default as NativeBridge} from "./native-bridge.js";
115
115
 
116
116
  export {default as getGeoLocation} from './geo-location.js';
@@ -1,9 +1,17 @@
1
+ /**
2
+ * A dictionary-like structure with caching and expiration capabilities.
3
+ * @template T - The type of the values stored in the cache.
4
+ */
1
5
  export default class CacheDictionary<T> {
2
6
  private readonly fallback: ((key: string) => T) | null;
3
7
  private readonly cache: { [key: string]: T };
4
8
  private readonly defaultDuration: number | null;
5
9
  private readonly expiration: { [key: string]: Date | undefined };
6
10
 
11
+ /**
12
+ * @param {((key: string) => T) | null} fallback - Optional function to call when a key is not found.
13
+ * @param {number | null} defaultDuration - Default duration in seconds for cache items.
14
+ */
7
15
  constructor(fallback: ((key: string) => T) | null = null, defaultDuration: number | null = null) {
8
16
  this.fallback = fallback;
9
17
  this.cache = {};
@@ -11,15 +19,29 @@ export default class CacheDictionary<T> {
11
19
  this.expiration = {};
12
20
  }
13
21
 
14
-
22
+ /**
23
+ * Gets the expiration date for a specific key.
24
+ * @param {string} key - The key.
25
+ * @returns {Date | undefined} The expiration date or undefined.
26
+ */
15
27
  public getExpiration(key: string): Date | undefined {
16
28
  return this.expiration[key];
17
29
  }
18
30
 
31
+ /**
32
+ * Sets a specific expiration date for a key.
33
+ * @param {string} key - The key.
34
+ * @param {Date | undefined} expiration - The expiration date.
35
+ */
19
36
  public setExpiration(key: string, expiration: Date | undefined): void {
20
37
  this.expiration[key] = expiration;
21
38
  }
22
39
 
40
+ /**
41
+ * Sets a duration in seconds for a key's expiration.
42
+ * @param {string} key - The key.
43
+ * @param {number | null} duration - Duration in seconds. If null, expiration is removed.
44
+ */
23
45
  public setDuration(key: string, duration: number | null): void {
24
46
  if (duration === null) {
25
47
  delete this.expiration[key];
@@ -30,6 +52,12 @@ export default class CacheDictionary<T> {
30
52
  }
31
53
  }
32
54
 
55
+ /**
56
+ * Gets a value from the cache. If not found and a fallback exists, it uses the fallback.
57
+ * If the item is expired, it's removed and null is returned.
58
+ * @param {string} key - The key to retrieve.
59
+ * @returns {T | null} The value or null if not found/expired.
60
+ */
33
61
  public get(key: string): T | null {
34
62
  if (!this.cache.hasOwnProperty(key)) {
35
63
  if (this.fallback) {
@@ -48,11 +76,21 @@ export default class CacheDictionary<T> {
48
76
  return this.cache[key];
49
77
  }
50
78
 
79
+ /**
80
+ * Sets a value in the cache with an optional duration.
81
+ * @param {string} key - The key.
82
+ * @param {T} value - The value to store.
83
+ * @param {number | null} duration - Duration in seconds.
84
+ */
51
85
  public set(key: string, value: T, duration: number | null = null): void {
52
86
  this.cache[key] = value;
53
87
  this.expiration[key] = this.calculateExpiration(duration);
54
88
  }
55
89
 
90
+ /**
91
+ * Removes an item from the cache.
92
+ * @param {string} key - The key to remove.
93
+ */
56
94
  public remove(key: string): void {
57
95
  delete this.cache[key];
58
96
  delete this.expiration[key];
@@ -2,31 +2,37 @@ import type {Optional, UnaryFunction} from "../types.js";
2
2
 
3
3
  /**
4
4
  * DefaultMap<K, V>
5
- * Un Map que crea y guarda automáticamente un valor por defecto
6
- * cuando accedes a una clave inexistente con get(key).
5
+ * A Map that automatically creates and saves a default value
6
+ * when accessing a non-existent key with get(key).
7
7
  *
8
- * Ejemplo rápido:
8
+ * @template K - The type of the keys.
9
+ * @template V - The type of the values.
10
+ * @example
9
11
  * const m = new DefaultMap<string, number>(() => 0);
10
- * m.get("a") += 1; // ahora m.get("a") === 1
12
+ * m.get("a"); // 0
13
+ * m.set("a", m.get("a") + 1); // 1
11
14
  */
12
15
  export default class DefaultMap<K, V> extends Map<K, V> {
13
16
  private readonly _factoryMethod: (key: K) => V;
14
17
 
15
18
  /**
16
- * @param factoryMethod Función que produce el valor por defecto para una clave.
17
- * @param entries Entradas iniciales.
19
+ * @param {UnaryFunction<K, V>} factoryMethod - Function that produces the default value for a key.
20
+ * @param {Optional<Iterable<[K, V]>>} entries - Initial entries.
18
21
  */
19
22
  constructor(factoryMethod: UnaryFunction<K, V>, entries: Optional<Iterable<[K, V]>> = undefined) {
20
23
  super(entries);
21
24
  if (typeof factoryMethod !== "function") {
22
- throw new TypeError("DefaultMap necesita una factory (key => defaultValue).");
25
+ throw new TypeError("DefaultMap needs a factory (key => defaultValue).");
23
26
  }
24
27
  this._factoryMethod = factoryMethod;
25
28
  }
26
29
 
27
30
  /**
28
- * Obtiene el valor de la clave. Si no existe, lo crea con la factory,
29
- * lo guarda y lo devuelve.
31
+ * Gets the value for the key. If it does not exist, it creates it using the factory,
32
+ * saves it, and returns it.
33
+ *
34
+ * @param {K} key - The key to get.
35
+ * @returns {V} The value associated with the key.
30
36
  */
31
37
  override get(key: K): V {
32
38
  if (!super.has(key)) {
@@ -1,20 +1,19 @@
1
1
  import type {Optional, UnaryFunction} from "../types.js";
2
2
 
3
3
  /**
4
- * DefaultMap<K, V>
5
- * Un Map que crea y guarda automáticamente un valor por defecto
6
- * cuando accedes a una clave inexistente con get(key).
4
+ * DefaultWeakMap<K, V>
5
+ * A WeakMap that automatically creates and saves a default value
6
+ * when accessing a non-existent key with get(key).
7
7
  *
8
- * Ejemplo rápido:
9
- * const m = new DefaultMap<string, number>(() => 0);
10
- * m.get("a") += 1; // ahora m.get("a") === 1
8
+ * @template K - The type of the keys. Must be an object.
9
+ * @template V - The type of the values.
11
10
  */
12
- export default class DefaultMap<K extends object, V> extends WeakMap<K, V> {
11
+ export default class DefaultWeakMap<K extends object, V> extends WeakMap<K, V> {
13
12
  private readonly _factoryMethod: (key: K) => V;
14
13
 
15
14
  /**
16
- * @param factoryMethod Función que produce el valor por defecto para una clave.
17
- * @param entries Entradas iniciales.
15
+ * @param {UnaryFunction<K, V>} factoryMethod - Function that produces the default value for a key.
16
+ * @param {Optional<Iterable<[K, V]>>} entries - Initial entries.
18
17
  */
19
18
  constructor(factoryMethod: UnaryFunction<K, V>, entries: Optional<Iterable<[K, V]>> = undefined) {
20
19
  super();
@@ -26,14 +25,17 @@ export default class DefaultMap<K extends object, V> extends WeakMap<K, V> {
26
25
  }
27
26
 
28
27
  if (typeof factoryMethod !== "function") {
29
- throw new TypeError("DefaultMap necesita una factory (key => defaultValue).");
28
+ throw new TypeError("DefaultWeakMap needs a factory (key => defaultValue).");
30
29
  }
31
30
  this._factoryMethod = factoryMethod;
32
31
  }
33
32
 
34
33
  /**
35
- * Obtiene el valor de la clave. Si no existe, lo crea con la factory,
36
- * lo guarda y lo devuelve.
34
+ * Gets the value for the key. If it does not exist, it creates it using the factory,
35
+ * saves it, and returns it.
36
+ *
37
+ * @param {K} key - The key to get.
38
+ * @returns {V} The value associated with the key.
37
39
  */
38
40
  override get(key: K): V {
39
41
  if (!super.has(key)) {