dphelper 4.6.0 → 4.6.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/COPYRIGHT.md +6 -6
  2. package/FUNDING.yml +12 -12
  3. package/LICENSE.md +21 -21
  4. package/README.md +417 -397
  5. package/SECURITY.md +26 -26
  6. package/SUMMARY.md +83 -83
  7. package/index.cjs +1 -1
  8. package/index.d.ts +1 -1
  9. package/index.js +1 -1
  10. package/llms.txt +73 -73
  11. package/modules/ai.cjs +1 -1
  12. package/modules/ai.d.ts +11 -11
  13. package/modules/ai.js +1 -1
  14. package/modules/anchor.cjs +1 -1
  15. package/modules/anchor.d.ts +6 -6
  16. package/modules/anchor.js +1 -1
  17. package/modules/array.cjs +1 -1
  18. package/modules/array.d.ts +21 -21
  19. package/modules/array.js +1 -1
  20. package/modules/audio.cjs +1 -1
  21. package/modules/audio.d.ts +10 -10
  22. package/modules/audio.js +1 -1
  23. package/modules/avoid.cjs +1 -1
  24. package/modules/avoid.d.ts +2 -2
  25. package/modules/avoid.js +1 -1
  26. package/modules/biometric.cjs +1 -1
  27. package/modules/biometric.d.ts +14 -14
  28. package/modules/biometric.js +1 -1
  29. package/modules/browser.cjs +1 -1
  30. package/modules/browser.d.ts +10 -10
  31. package/modules/browser.js +1 -1
  32. package/modules/check.cjs +1 -1
  33. package/modules/check.d.ts +4 -4
  34. package/modules/check.js +1 -1
  35. package/modules/color.cjs +1 -1
  36. package/modules/color.d.ts +6 -6
  37. package/modules/color.js +1 -1
  38. package/modules/compress.cjs +1 -1
  39. package/modules/compress.d.ts +13 -13
  40. package/modules/compress.js +1 -1
  41. package/modules/cookie.cjs +1 -1
  42. package/modules/cookie.d.ts +12 -12
  43. package/modules/cookie.js +1 -1
  44. package/modules/coords.cjs +1 -1
  45. package/modules/coords.d.ts +8 -8
  46. package/modules/coords.js +1 -1
  47. package/modules/credits.cjs +1 -1
  48. package/modules/credits.d.ts +11 -11
  49. package/modules/credits.js +1 -1
  50. package/modules/date.cjs +1 -1
  51. package/modules/date.d.ts +25 -25
  52. package/modules/date.js +1 -1
  53. package/modules/disable.cjs +1 -1
  54. package/modules/disable.d.ts +8 -8
  55. package/modules/disable.js +1 -1
  56. package/modules/dispatch.cjs +1 -1
  57. package/modules/dispatch.d.ts +4 -4
  58. package/modules/dispatch.js +1 -1
  59. package/modules/elements.cjs +1 -1
  60. package/modules/elements.d.ts +3 -3
  61. package/modules/elements.js +1 -1
  62. package/modules/events.cjs +1 -1
  63. package/modules/events.d.ts +6 -6
  64. package/modules/events.js +1 -1
  65. package/modules/fetch.cjs +1 -1
  66. package/modules/fetch.d.ts +15 -15
  67. package/modules/fetch.js +1 -1
  68. package/modules/form.cjs +1 -1
  69. package/modules/form.d.ts +13 -13
  70. package/modules/form.js +1 -1
  71. package/modules/format.cjs +1 -1
  72. package/modules/format.d.ts +3 -3
  73. package/modules/format.js +1 -1
  74. package/modules/i18n.cjs +1 -1
  75. package/modules/i18n.d.ts +11 -11
  76. package/modules/i18n.js +1 -1
  77. package/modules/image.cjs +1 -1
  78. package/modules/image.d.ts +13 -13
  79. package/modules/image.js +1 -1
  80. package/modules/json.cjs +1 -1
  81. package/modules/json.d.ts +8 -8
  82. package/modules/json.js +1 -1
  83. package/modules/load.cjs +1 -1
  84. package/modules/load.d.ts +8 -8
  85. package/modules/load.js +1 -1
  86. package/modules/logging.cjs +1 -1
  87. package/modules/logging.d.ts +8 -8
  88. package/modules/logging.js +1 -1
  89. package/modules/math.cjs +1 -1
  90. package/modules/math.d.ts +13 -13
  91. package/modules/math.js +1 -1
  92. package/modules/memory.cjs +1 -1
  93. package/modules/memory.d.ts +3 -3
  94. package/modules/memory.js +1 -1
  95. package/modules/navigation.cjs +1 -1
  96. package/modules/navigation.d.ts +4 -4
  97. package/modules/navigation.js +1 -1
  98. package/modules/net.cjs +1 -1
  99. package/modules/net.d.ts +10 -10
  100. package/modules/net.js +1 -1
  101. package/modules/objects.cjs +1 -1
  102. package/modules/objects.d.ts +15 -15
  103. package/modules/objects.js +1 -1
  104. package/modules/path.cjs +1 -1
  105. package/modules/path.d.ts +4 -4
  106. package/modules/path.js +1 -1
  107. package/modules/promise.cjs +1 -1
  108. package/modules/promise.d.ts +3 -3
  109. package/modules/promise.js +1 -1
  110. package/modules/sanitize.cjs +1 -1
  111. package/modules/sanitize.d.ts +2 -2
  112. package/modules/sanitize.js +1 -1
  113. package/modules/screen.cjs +1 -1
  114. package/modules/screen.d.ts +11 -11
  115. package/modules/screen.js +1 -1
  116. package/modules/scrollbar.cjs +1 -1
  117. package/modules/scrollbar.d.ts +9 -9
  118. package/modules/scrollbar.js +1 -1
  119. package/modules/security.cjs +1 -1
  120. package/modules/security.d.ts +15 -15
  121. package/modules/security.js +1 -1
  122. package/modules/shortcut.cjs +1 -1
  123. package/modules/shortcut.d.ts +2 -2
  124. package/modules/shortcut.js +1 -1
  125. package/modules/socket.cjs +1 -1
  126. package/modules/socket.d.ts +13 -13
  127. package/modules/socket.js +1 -1
  128. package/modules/sse.cjs +1 -1
  129. package/modules/sse.d.ts +8 -8
  130. package/modules/sse.js +1 -1
  131. package/modules/svg.cjs +1 -1
  132. package/modules/svg.d.ts +12 -12
  133. package/modules/svg.js +1 -1
  134. package/modules/sync.cjs +1 -1
  135. package/modules/sync.d.ts +13 -13
  136. package/modules/sync.js +1 -1
  137. package/modules/system.cjs +1 -1
  138. package/modules/system.d.ts +2 -2
  139. package/modules/system.js +1 -1
  140. package/modules/text.cjs +1 -1
  141. package/modules/text.d.ts +13 -13
  142. package/modules/text.js +1 -1
  143. package/modules/timer.cjs +1 -1
  144. package/modules/timer.d.ts +3 -3
  145. package/modules/timer.js +1 -1
  146. package/modules/tools.cjs +1 -1
  147. package/modules/tools.d.ts +5 -5
  148. package/modules/tools.js +1 -1
  149. package/modules/translators.cjs +1 -1
  150. package/modules/translators.d.ts +2 -2
  151. package/modules/translators.js +1 -1
  152. package/modules/triggers.cjs +1 -1
  153. package/modules/triggers.d.ts +43 -43
  154. package/modules/triggers.js +1 -1
  155. package/modules/types.cjs +1 -1
  156. package/modules/types.d.ts +5 -5
  157. package/modules/types.js +1 -1
  158. package/modules/ui.cjs +1 -1
  159. package/modules/ui.d.ts +3 -3
  160. package/modules/ui.js +1 -1
  161. package/modules/window.cjs +1 -1
  162. package/modules/window.d.ts +9 -9
  163. package/modules/window.js +1 -1
  164. package/modules/worker.cjs +1 -1
  165. package/modules/worker.d.ts +16 -16
  166. package/modules/worker.js +1 -1
  167. package/package.json +1 -1
  168. package/sbom.json +9 -14
  169. package/types/dphelper.d.ts +546 -546
  170. package/types/global.d.ts +8 -8
package/modules/check.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var c={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var u={version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...c},configurable:true,writable:true},version:{value:u.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,o,a)=>{Object.defineProperty(e,o.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[o.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,o)=>{Object.defineProperties(i,{[e.name]:{value:o,writable:false,configurable:false,enumerable:false}}),Object.keys(o).map(a=>(Object.defineProperties(i[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var m={name:"check",active:true,subCommand:[{name:"version",version:"0.0.2",example:"dphelper.check.version([v1], [v2], [opts])",description:"Compares two versions.",author:"Dario Passariello",creationDate:"20240829",lastMod:"20240829",type:"function",active:true,env:"both",subCommand:[]}]},d={version:(e,o,a)=>{if(!(e&&o))return Number.NaN;let s=a?.lex,b=a?.zero,t=e.split("."),r=o.split("."),p=l=>(s?/^\d+[A-Za-z]*$/:/^\d+$/).test(l);if(!(t.every(p)&&r.every(p)))return Number.NaN;if(b){for(;t.length<r.length;)t.push("0");for(;r.length<t.length;)r.push("0");}s||(t=t.map(Number),r=r.map(Number));for(let l=0;l<t.length;l++){if(r.length===l)return 1;if(t[l]!==r[l])return t[l]>r[l]?1:-1}return t.length!==r.length?-1:0}};dphelper?.setDescription(m,d);var D=dphelper.check;exports.check=D;
1
+ 'use strict';var c={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var u={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...c},configurable:true,writable:true},version:{value:u.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,o,a)=>{Object.defineProperty(e,o.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[o.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,o)=>{Object.defineProperties(i,{[e.name]:{value:o,writable:false,configurable:false,enumerable:false}}),Object.keys(o).map(a=>(Object.defineProperties(i[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var m={name:"check",active:true,subCommand:[{name:"version",version:"0.0.2",example:"dphelper.check.version([v1], [v2], [opts])",description:"Compares two versions.",author:"Dario Passariello",creationDate:"20240829",lastMod:"20240829",type:"function",active:true,env:"both",subCommand:[]}]},d={version:(e,o,a)=>{if(!(e&&o))return Number.NaN;let s=a?.lex,b=a?.zero,t=e.split("."),r=o.split("."),p=l=>(s?/^\d+[A-Za-z]*$/:/^\d+$/).test(l);if(!(t.every(p)&&r.every(p)))return Number.NaN;if(b){for(;t.length<r.length;)t.push("0");for(;r.length<t.length;)r.push("0");}s||(t=t.map(Number),r=r.map(Number));for(let l=0;l<t.length;l++){if(r.length===l)return 1;if(t[l]!==r[l])return t[l]>r[l]?1:-1}return t.length!==r.length?-1:0}};dphelper?.setDescription(m,d);var D=dphelper.check;exports.check=D;
@@ -1,8 +1,8 @@
1
1
  /// <reference path="../types/dphelper.d.ts" />
2
- export interface CheckTool {
3
- url: (url: string) => any
4
- version: (v1: string, v2: string, opts?: any) => any
5
- npmVer: (npm: string) => any
2
+ export interface CheckTool {
3
+ url: (url: string) => any
4
+ version: (v1: string, v2: string, opts?: any) => any
5
+ npmVer: (npm: string) => any
6
6
  }
7
7
 
8
8
  export const check: CheckTool
package/modules/check.js CHANGED
@@ -1 +1 @@
1
- var u={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var b={version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...u},configurable:true,writable:true},version:{value:b.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,o,a)=>{Object.defineProperty(e,o.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[o.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,o)=>{Object.defineProperties(i,{[e.name]:{value:o,writable:false,configurable:false,enumerable:false}}),Object.keys(o).map(a=>(Object.defineProperties(i[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var d={name:"check",active:true,subCommand:[{name:"version",version:"0.0.2",example:"dphelper.check.version([v1], [v2], [opts])",description:"Compares two versions.",author:"Dario Passariello",creationDate:"20240829",lastMod:"20240829",type:"function",active:true,env:"both",subCommand:[]}]},g={version:(e,o,a)=>{if(!(e&&o))return Number.NaN;let p=a?.lex,f=a?.zero,t=e.split("."),r=o.split("."),c=l=>(p?/^\d+[A-Za-z]*$/:/^\d+$/).test(l);if(!(t.every(c)&&r.every(c)))return Number.NaN;if(f){for(;t.length<r.length;)t.push("0");for(;r.length<t.length;)r.push("0");}p||(t=t.map(Number),r=r.map(Number));for(let l=0;l<t.length;l++){if(r.length===l)return 1;if(t[l]!==r[l])return t[l]>r[l]?1:-1}return t.length!==r.length?-1:0}};dphelper?.setDescription(d,g);var z=dphelper.check;export{z as check};
1
+ var u={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var b={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...u},configurable:true,writable:true},version:{value:b.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,o,a)=>{Object.defineProperty(e,o.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[o.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,o)=>{Object.defineProperties(i,{[e.name]:{value:o,writable:false,configurable:false,enumerable:false}}),Object.keys(o).map(a=>(Object.defineProperties(i[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var d={name:"check",active:true,subCommand:[{name:"version",version:"0.0.2",example:"dphelper.check.version([v1], [v2], [opts])",description:"Compares two versions.",author:"Dario Passariello",creationDate:"20240829",lastMod:"20240829",type:"function",active:true,env:"both",subCommand:[]}]},g={version:(e,o,a)=>{if(!(e&&o))return Number.NaN;let p=a?.lex,f=a?.zero,t=e.split("."),r=o.split("."),c=l=>(p?/^\d+[A-Za-z]*$/:/^\d+$/).test(l);if(!(t.every(c)&&r.every(c)))return Number.NaN;if(f){for(;t.length<r.length;)t.push("0");for(;r.length<t.length;)r.push("0");}p||(t=t.map(Number),r=r.map(Number));for(let l=0;l<t.length;l++){if(r.length===l)return 1;if(t[l]!==r[l])return t[l]>r[l]?1:-1}return t.length!==r.length?-1:0}};dphelper?.setDescription(d,g);var z=dphelper.check;export{z as check};
package/modules/color.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var m={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var b={version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...m},configurable:true,writable:true},version:{value:b.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var o=dphelper;Object.defineProperty(o,"setProps",{value:(r,e,a)=>{Object.defineProperty(r,e.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(r[e.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(r,e)=>{Object.defineProperties(o,{[r.name]:{value:e,writable:false,configurable:false,enumerable:false}}),Object.keys(e).map(a=>(Object.defineProperties(o[r.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,r,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(r);}});var f={name:"color",active:true,subCommand:[{name:"hex",version:"0.0.2",example:"dphelper.color.hex(255)",description:"Converts a number to a hexadecimal string.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"toHex",version:"0.0.2",example:"dphelper.color.toHex([255, 255, 255])",description:"Converts an RGB array to a hexadecimal string.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"toRGB",version:"0.0.2",example:"dphelper.color.toRGB('#ffffff')",description:"Converts a hexadecimal string to an RGB array.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"oleColor",version:"0.0.2",example:"dphelper.color.oleColor('#ffffff')",description:"Converts a hexadecimal string to an OLE color.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"gradient",version:"0.0.2",example:"dphelper.color.gradient([colorStart, colorEnd, colorCount])",description:"Generates a gradient between two colors.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]}]},g={hex:r=>{let e=Number.parseInt(r.toString(),10);return Number.isNaN(e)?"00":(e=Math.round(Math.max(0,Math.min(255,e))),e.toString(16).padStart(2,"0"))},toHex:r=>dphelper.color.hex(r[0])+dphelper.color.hex(r[1])+dphelper.color.hex(r[2]),toRGB:r=>{let e=[];return e[0]=Number.parseInt(dphelper.text.trim(r,"#",1,7).substring(0,2),16),e[1]=Number.parseInt(dphelper.text.trim(r,"#",1,7).substring(2,4),16),e[2]=Number.parseInt(dphelper.text.trim(r,"#",1,7).substring(4,6),16),e},oleColor:r=>{let e=r.replace("#","").match(/.{1,2}/g);return !e||e.length<3?"0":(Number.parseInt(e[0],16)+Number.parseInt(e[1],16)*256+Number.parseInt(e[2],16)*65536).toString()},gradient:(r,e,a)=>{let n=dphelper.color.toRGB(r),i=dphelper.color.toRGB(e),p=a,c=[],t=0,l=[];for(let u=0;u<p;u++)t+=1/p,l[0]=n[0]*t+(1-t)*i[0],l[1]=n[1]*t+(1-t)*i[1],l[2]=n[2]*t+(1-t)*i[2],c.push(dphelper.color.toHex(l));return c}};dphelper?.setDescription(f,g);var R=dphelper.color;exports.color=R;
1
+ 'use strict';var m={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var b={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...m},configurable:true,writable:true},version:{value:b.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var o=dphelper;Object.defineProperty(o,"setProps",{value:(r,e,a)=>{Object.defineProperty(r,e.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(r[e.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(r,e)=>{Object.defineProperties(o,{[r.name]:{value:e,writable:false,configurable:false,enumerable:false}}),Object.keys(e).map(a=>(Object.defineProperties(o[r.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,r,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(r);}});var f={name:"color",active:true,subCommand:[{name:"hex",version:"0.0.2",example:"dphelper.color.hex(255)",description:"Converts a number to a hexadecimal string.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"toHex",version:"0.0.2",example:"dphelper.color.toHex([255, 255, 255])",description:"Converts an RGB array to a hexadecimal string.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"toRGB",version:"0.0.2",example:"dphelper.color.toRGB('#ffffff')",description:"Converts a hexadecimal string to an RGB array.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"oleColor",version:"0.0.2",example:"dphelper.color.oleColor('#ffffff')",description:"Converts a hexadecimal string to an OLE color.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"gradient",version:"0.0.2",example:"dphelper.color.gradient([colorStart, colorEnd, colorCount])",description:"Generates a gradient between two colors.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]}]},g={hex:r=>{let e=Number.parseInt(r.toString(),10);return Number.isNaN(e)?"00":(e=Math.round(Math.max(0,Math.min(255,e))),e.toString(16).padStart(2,"0"))},toHex:r=>dphelper.color.hex(r[0])+dphelper.color.hex(r[1])+dphelper.color.hex(r[2]),toRGB:r=>{let e=[];return e[0]=Number.parseInt(dphelper.text.trim(r,"#",1,7).substring(0,2),16),e[1]=Number.parseInt(dphelper.text.trim(r,"#",1,7).substring(2,4),16),e[2]=Number.parseInt(dphelper.text.trim(r,"#",1,7).substring(4,6),16),e},oleColor:r=>{let e=r.replace("#","").match(/.{1,2}/g);return !e||e.length<3?"0":(Number.parseInt(e[0],16)+Number.parseInt(e[1],16)*256+Number.parseInt(e[2],16)*65536).toString()},gradient:(r,e,a)=>{let n=dphelper.color.toRGB(r),i=dphelper.color.toRGB(e),p=a,c=[],t=0,l=[];for(let u=0;u<p;u++)t+=1/p,l[0]=n[0]*t+(1-t)*i[0],l[1]=n[1]*t+(1-t)*i[1],l[2]=n[2]*t+(1-t)*i[2],c.push(dphelper.color.toHex(l));return c}};dphelper?.setDescription(f,g);var R=dphelper.color;exports.color=R;
@@ -1,10 +1,10 @@
1
1
  /// <reference path="../types/dphelper.d.ts" />
2
- export interface ColorTool {
3
- hex: (c: any) => string
4
- toHex: (rgb: any) => string
5
- toRGB: (c: any) => number[]
6
- oleColor: (c: any) => string
7
- gradient: (colorStart: any, colorEnd: any, colorCount: any) => any
2
+ export interface ColorTool {
3
+ hex: (c: any) => string
4
+ toHex: (rgb: any) => string
5
+ toRGB: (c: any) => number[]
6
+ oleColor: (c: any) => string
7
+ gradient: (colorStart: any, colorEnd: any, colorCount: any) => any
8
8
  }
9
9
 
10
10
  export const color: ColorTool
package/modules/color.js CHANGED
@@ -1 +1 @@
1
- var b={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var d={version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...b},configurable:true,writable:true},version:{value:d.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var o=dphelper;Object.defineProperty(o,"setProps",{value:(r,e,a)=>{Object.defineProperty(r,e.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(r[e.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(r,e)=>{Object.defineProperties(o,{[r.name]:{value:e,writable:false,configurable:false,enumerable:false}}),Object.keys(e).map(a=>(Object.defineProperties(o[r.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,r,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(r);}});var g={name:"color",active:true,subCommand:[{name:"hex",version:"0.0.2",example:"dphelper.color.hex(255)",description:"Converts a number to a hexadecimal string.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"toHex",version:"0.0.2",example:"dphelper.color.toHex([255, 255, 255])",description:"Converts an RGB array to a hexadecimal string.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"toRGB",version:"0.0.2",example:"dphelper.color.toRGB('#ffffff')",description:"Converts a hexadecimal string to an RGB array.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"oleColor",version:"0.0.2",example:"dphelper.color.oleColor('#ffffff')",description:"Converts a hexadecimal string to an OLE color.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"gradient",version:"0.0.2",example:"dphelper.color.gradient([colorStart, colorEnd, colorCount])",description:"Generates a gradient between two colors.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]}]},v={hex:r=>{let e=Number.parseInt(r.toString(),10);return Number.isNaN(e)?"00":(e=Math.round(Math.max(0,Math.min(255,e))),e.toString(16).padStart(2,"0"))},toHex:r=>dphelper.color.hex(r[0])+dphelper.color.hex(r[1])+dphelper.color.hex(r[2]),toRGB:r=>{let e=[];return e[0]=Number.parseInt(dphelper.text.trim(r,"#",1,7).substring(0,2),16),e[1]=Number.parseInt(dphelper.text.trim(r,"#",1,7).substring(2,4),16),e[2]=Number.parseInt(dphelper.text.trim(r,"#",1,7).substring(4,6),16),e},oleColor:r=>{let e=r.replace("#","").match(/.{1,2}/g);return !e||e.length<3?"0":(Number.parseInt(e[0],16)+Number.parseInt(e[1],16)*256+Number.parseInt(e[2],16)*65536).toString()},gradient:(r,e,a)=>{let n=dphelper.color.toRGB(r),i=dphelper.color.toRGB(e),c=a,u=[],t=0,l=[];for(let m=0;m<c;m++)t+=1/c,l[0]=n[0]*t+(1-t)*i[0],l[1]=n[1]*t+(1-t)*i[1],l[2]=n[2]*t+(1-t)*i[2],u.push(dphelper.color.toHex(l));return u}};dphelper?.setDescription(g,v);var N=dphelper.color;export{N as color};
1
+ var b={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var d={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...b},configurable:true,writable:true},version:{value:d.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var o=dphelper;Object.defineProperty(o,"setProps",{value:(r,e,a)=>{Object.defineProperty(r,e.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(r[e.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(r,e)=>{Object.defineProperties(o,{[r.name]:{value:e,writable:false,configurable:false,enumerable:false}}),Object.keys(e).map(a=>(Object.defineProperties(o[r.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,r,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(r);}});var g={name:"color",active:true,subCommand:[{name:"hex",version:"0.0.2",example:"dphelper.color.hex(255)",description:"Converts a number to a hexadecimal string.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"toHex",version:"0.0.2",example:"dphelper.color.toHex([255, 255, 255])",description:"Converts an RGB array to a hexadecimal string.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"toRGB",version:"0.0.2",example:"dphelper.color.toRGB('#ffffff')",description:"Converts a hexadecimal string to an RGB array.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"oleColor",version:"0.0.2",example:"dphelper.color.oleColor('#ffffff')",description:"Converts a hexadecimal string to an OLE color.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]},{name:"gradient",version:"0.0.2",example:"dphelper.color.gradient([colorStart, colorEnd, colorCount])",description:"Generates a gradient between two colors.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"client",subCommand:[]}]},v={hex:r=>{let e=Number.parseInt(r.toString(),10);return Number.isNaN(e)?"00":(e=Math.round(Math.max(0,Math.min(255,e))),e.toString(16).padStart(2,"0"))},toHex:r=>dphelper.color.hex(r[0])+dphelper.color.hex(r[1])+dphelper.color.hex(r[2]),toRGB:r=>{let e=[];return e[0]=Number.parseInt(dphelper.text.trim(r,"#",1,7).substring(0,2),16),e[1]=Number.parseInt(dphelper.text.trim(r,"#",1,7).substring(2,4),16),e[2]=Number.parseInt(dphelper.text.trim(r,"#",1,7).substring(4,6),16),e},oleColor:r=>{let e=r.replace("#","").match(/.{1,2}/g);return !e||e.length<3?"0":(Number.parseInt(e[0],16)+Number.parseInt(e[1],16)*256+Number.parseInt(e[2],16)*65536).toString()},gradient:(r,e,a)=>{let n=dphelper.color.toRGB(r),i=dphelper.color.toRGB(e),c=a,u=[],t=0,l=[];for(let m=0;m<c;m++)t+=1/c,l[0]=n[0]*t+(1-t)*i[0],l[1]=n[1]*t+(1-t)*i[1],l[2]=n[2]*t+(1-t)*i[2],u.push(dphelper.color.toHex(l));return u}};dphelper?.setDescription(g,v);var N=dphelper.color;export{N as color};
@@ -1 +1 @@
1
- 'use strict';var d={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var m={version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...d},configurable:true,writable:true},version:{value:m.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var a=dphelper;Object.defineProperty(a,"setProps",{value:(t,r,e)=>{Object.defineProperty(t,r.name,e||{writable:false,configurable:false,enumerable:false}),e?.lock&&Object.freeze(t[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(t,r)=>{Object.defineProperties(a,{[t.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(e=>(Object.defineProperties(a[t.name],{[e]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,t,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(t);}});var f={name:"compress",active:true,subCommand:[{name:"gzip",version:"0.0.1",example:"dphelper.compress.gzip('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Compress data using gzip",env:"both",subCommand:[]},{name:"gunzip",version:"0.0.1",example:"dphelper.compress.gunzip(compressedData)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decompress gzip data",env:"both",subCommand:[]},{name:"deflate",version:"0.0.1",example:"dphelper.compress.deflate('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Compress data using deflate",env:"both",subCommand:[]},{name:"inflate",version:"0.0.1",example:"dphelper.compress.inflate(compressedData)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decompress deflate data",env:"both",subCommand:[]},{name:"compress",version:"0.0.1",example:"dphelper.compress.compress('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Compress data using LZW algorithm (JavaScript compatible)",env:"both",subCommand:[]},{name:"decompress",version:"0.0.1",example:"dphelper.compress.decompress(compressedString)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decompress LZW compressed data",env:"both",subCommand:[]},{name:"base64Encode",version:"0.0.1",example:"dphelper.compress.base64Encode('Hello')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Encode string to base64",env:"both",subCommand:[]},{name:"base64Decode",version:"0.0.1",example:"dphelper.compress.base64Decode('SGVsbG8=')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decode base64 string",env:"both",subCommand:[]},{name:"urlEncode",version:"0.0.1",example:"dphelper.compress.urlEncode('Hello World!')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"URL encode a string",env:"both",subCommand:[]},{name:"urlDecode",version:"0.0.1",example:"dphelper.compress.urlDecode('Hello%20World!')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"URL decode a string",env:"both",subCommand:[]},{name:"htmlEncode",version:"0.0.1",example:"dphelper.compress.htmlEncode('<script>')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"HTML encode a string",env:"both",subCommand:[]},{name:"htmlDecode",version:"0.0.1",example:"dphelper.compress.htmlDecode('<script>')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"HTML decode a string",env:"both",subCommand:[]}]},h=async t=>{let r=typeof t=="string"?new TextEncoder().encode(t):t,e=new CompressionStream("gzip"),o=e.writable.getWriter();return o.write(r.buffer),o.close(),new Response(e.readable).blob()},g=async t=>{let r=new DecompressionStream("gzip"),e=r.writable.getWriter();e.write(await t.arrayBuffer()),e.close();let o=await new Response(r.readable).arrayBuffer();return new TextDecoder().decode(o)},v=async t=>{let r=typeof t=="string"?new TextEncoder().encode(t):t,e=new CompressionStream("deflate"),o=e.writable.getWriter();return o.write(r.buffer),o.close(),new Response(e.readable).blob()},w=async t=>{let r=new DecompressionStream("deflate"),e=r.writable.getWriter();e.write(await t.arrayBuffer()),e.close();let o=await new Response(r.readable).arrayBuffer();return new TextDecoder().decode(o)},D=t=>{let r={},e="",o=[],i=256;for(let s=0;s<256;s++)r[String.fromCharCode(s)]=s;for(let s=0;s<t.length;s++){let n=t[s],l=e+n;r[l]!==void 0?e=l:(o.push(String(r[e])),r[l]=i++,e=n);}return e!==""&&o.push(String(r[e])),String.fromCharCode(...o.map(Number))},y=t=>{let r={},e=[],o=256;for(let n=0;n<256;n++)r[n]=String.fromCharCode(n);let i=t.split("").map(n=>n.charCodeAt(0)),s=r[i[0]];e.push(s);for(let n=1;n<i.length;n++){let l=i[n],c=r[l];c===void 0&&(c=s+s[0]),e.push(c),r[o++]=s+c[0],s=c;}return e.join("")},C=t=>{let r=new TextEncoder().encode(t),e="";return r.forEach(o=>e+=String.fromCharCode(o)),btoa(e)},P=t=>{let r=atob(t),e=new Uint8Array(r.length);for(let o=0;o<r.length;o++)e[o]=r.charCodeAt(o);return new TextDecoder().decode(e)},x=t=>encodeURIComponent(t),S=t=>decodeURIComponent(t),j=t=>{let r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return t.replace(/[&<>"']/g,e=>r[e]||e)},E=t=>{let r={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"};return t.replace(/&(amp|lt|gt|quot|#39);/g,(e,o)=>r[`&${o};`]||e)},M={gzip:h,gunzip:g,deflate:v,inflate:w,compress:D,decompress:y,base64Encode:C,base64Decode:P,urlEncode:x,urlDecode:S,htmlEncode:j,htmlDecode:E};dphelper?.setDescription(f,M);var U=dphelper.compress;exports.compress=U;
1
+ 'use strict';var d={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var m={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...d},configurable:true,writable:true},version:{value:m.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var a=dphelper;Object.defineProperty(a,"setProps",{value:(t,r,e)=>{Object.defineProperty(t,r.name,e||{writable:false,configurable:false,enumerable:false}),e?.lock&&Object.freeze(t[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(t,r)=>{Object.defineProperties(a,{[t.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(e=>(Object.defineProperties(a[t.name],{[e]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,t,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(t);}});var f={name:"compress",active:true,subCommand:[{name:"gzip",version:"0.0.1",example:"dphelper.compress.gzip('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Compress data using gzip",env:"both",subCommand:[]},{name:"gunzip",version:"0.0.1",example:"dphelper.compress.gunzip(compressedData)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decompress gzip data",env:"both",subCommand:[]},{name:"deflate",version:"0.0.1",example:"dphelper.compress.deflate('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Compress data using deflate",env:"both",subCommand:[]},{name:"inflate",version:"0.0.1",example:"dphelper.compress.inflate(compressedData)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decompress deflate data",env:"both",subCommand:[]},{name:"compress",version:"0.0.1",example:"dphelper.compress.compress('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Compress data using LZW algorithm (JavaScript compatible)",env:"both",subCommand:[]},{name:"decompress",version:"0.0.1",example:"dphelper.compress.decompress(compressedString)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decompress LZW compressed data",env:"both",subCommand:[]},{name:"base64Encode",version:"0.0.1",example:"dphelper.compress.base64Encode('Hello')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Encode string to base64",env:"both",subCommand:[]},{name:"base64Decode",version:"0.0.1",example:"dphelper.compress.base64Decode('SGVsbG8=')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decode base64 string",env:"both",subCommand:[]},{name:"urlEncode",version:"0.0.1",example:"dphelper.compress.urlEncode('Hello World!')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"URL encode a string",env:"both",subCommand:[]},{name:"urlDecode",version:"0.0.1",example:"dphelper.compress.urlDecode('Hello%20World!')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"URL decode a string",env:"both",subCommand:[]},{name:"htmlEncode",version:"0.0.1",example:"dphelper.compress.htmlEncode('<script>')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"HTML encode a string",env:"both",subCommand:[]},{name:"htmlDecode",version:"0.0.1",example:"dphelper.compress.htmlDecode('<script>')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"HTML decode a string",env:"both",subCommand:[]}]},h=async t=>{let r=typeof t=="string"?new TextEncoder().encode(t):t,e=new CompressionStream("gzip"),o=e.writable.getWriter();return o.write(r.buffer),o.close(),new Response(e.readable).blob()},g=async t=>{let r=new DecompressionStream("gzip"),e=r.writable.getWriter();e.write(await t.arrayBuffer()),e.close();let o=await new Response(r.readable).arrayBuffer();return new TextDecoder().decode(o)},v=async t=>{let r=typeof t=="string"?new TextEncoder().encode(t):t,e=new CompressionStream("deflate"),o=e.writable.getWriter();return o.write(r.buffer),o.close(),new Response(e.readable).blob()},w=async t=>{let r=new DecompressionStream("deflate"),e=r.writable.getWriter();e.write(await t.arrayBuffer()),e.close();let o=await new Response(r.readable).arrayBuffer();return new TextDecoder().decode(o)},D=t=>{let r={},e="",o=[],i=256;for(let s=0;s<256;s++)r[String.fromCharCode(s)]=s;for(let s=0;s<t.length;s++){let n=t[s],l=e+n;r[l]!==void 0?e=l:(o.push(String(r[e])),r[l]=i++,e=n);}return e!==""&&o.push(String(r[e])),String.fromCharCode(...o.map(Number))},y=t=>{let r={},e=[],o=256;for(let n=0;n<256;n++)r[n]=String.fromCharCode(n);let i=t.split("").map(n=>n.charCodeAt(0)),s=r[i[0]];e.push(s);for(let n=1;n<i.length;n++){let l=i[n],c=r[l];c===void 0&&(c=s+s[0]),e.push(c),r[o++]=s+c[0],s=c;}return e.join("")},C=t=>{let r=new TextEncoder().encode(t),e="";return r.forEach(o=>e+=String.fromCharCode(o)),btoa(e)},P=t=>{let r=atob(t),e=new Uint8Array(r.length);for(let o=0;o<r.length;o++)e[o]=r.charCodeAt(o);return new TextDecoder().decode(e)},x=t=>encodeURIComponent(t),S=t=>decodeURIComponent(t),j=t=>{let r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return t.replace(/[&<>"']/g,e=>r[e]||e)},E=t=>{let r={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"};return t.replace(/&(amp|lt|gt|quot|#39);/g,(e,o)=>r[`&${o};`]||e)},M={gzip:h,gunzip:g,deflate:v,inflate:w,compress:D,decompress:y,base64Encode:C,base64Decode:P,urlEncode:x,urlDecode:S,htmlEncode:j,htmlDecode:E};dphelper?.setDescription(f,M);var U=dphelper.compress;exports.compress=U;
@@ -1,17 +1,17 @@
1
1
  /// <reference path="../types/dphelper.d.ts" />
2
- export interface CompressTool {
3
- gzip: (data: string | Uint8Array) => Promise<Blob>
4
- gunzip: (blob: Blob) => Promise<string>
5
- deflate: (data: string | Uint8Array) => Promise<Blob>
6
- inflate: (blob: Blob) => Promise<string>
7
- compress: (data: string) => string
8
- decompress: (data: string) => string
9
- base64Encode: (data: string) => string
10
- base64Decode: (data: string) => string
11
- urlEncode: (data: string) => string
12
- urlDecode: (data: string) => string
13
- htmlEncode: (data: string) => string
14
- htmlDecode: (data: string) => string
2
+ export interface CompressTool {
3
+ gzip: (data: string | Uint8Array) => Promise<Blob>
4
+ gunzip: (blob: Blob) => Promise<string>
5
+ deflate: (data: string | Uint8Array) => Promise<Blob>
6
+ inflate: (blob: Blob) => Promise<string>
7
+ compress: (data: string) => string
8
+ decompress: (data: string) => string
9
+ base64Encode: (data: string) => string
10
+ base64Decode: (data: string) => string
11
+ urlEncode: (data: string) => string
12
+ urlDecode: (data: string) => string
13
+ htmlEncode: (data: string) => string
14
+ htmlDecode: (data: string) => string
15
15
  }
16
16
 
17
17
  export const compress: CompressTool
@@ -1 +1 @@
1
- var m={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var u={version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...m},configurable:true,writable:true},version:{value:u.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var a=dphelper;Object.defineProperty(a,"setProps",{value:(t,r,e)=>{Object.defineProperty(t,r.name,e||{writable:false,configurable:false,enumerable:false}),e?.lock&&Object.freeze(t[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(t,r)=>{Object.defineProperties(a,{[t.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(e=>(Object.defineProperties(a[t.name],{[e]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,t,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(t);}});var h={name:"compress",active:true,subCommand:[{name:"gzip",version:"0.0.1",example:"dphelper.compress.gzip('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Compress data using gzip",env:"both",subCommand:[]},{name:"gunzip",version:"0.0.1",example:"dphelper.compress.gunzip(compressedData)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decompress gzip data",env:"both",subCommand:[]},{name:"deflate",version:"0.0.1",example:"dphelper.compress.deflate('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Compress data using deflate",env:"both",subCommand:[]},{name:"inflate",version:"0.0.1",example:"dphelper.compress.inflate(compressedData)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decompress deflate data",env:"both",subCommand:[]},{name:"compress",version:"0.0.1",example:"dphelper.compress.compress('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Compress data using LZW algorithm (JavaScript compatible)",env:"both",subCommand:[]},{name:"decompress",version:"0.0.1",example:"dphelper.compress.decompress(compressedString)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decompress LZW compressed data",env:"both",subCommand:[]},{name:"base64Encode",version:"0.0.1",example:"dphelper.compress.base64Encode('Hello')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Encode string to base64",env:"both",subCommand:[]},{name:"base64Decode",version:"0.0.1",example:"dphelper.compress.base64Decode('SGVsbG8=')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decode base64 string",env:"both",subCommand:[]},{name:"urlEncode",version:"0.0.1",example:"dphelper.compress.urlEncode('Hello World!')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"URL encode a string",env:"both",subCommand:[]},{name:"urlDecode",version:"0.0.1",example:"dphelper.compress.urlDecode('Hello%20World!')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"URL decode a string",env:"both",subCommand:[]},{name:"htmlEncode",version:"0.0.1",example:"dphelper.compress.htmlEncode('<script>')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"HTML encode a string",env:"both",subCommand:[]},{name:"htmlDecode",version:"0.0.1",example:"dphelper.compress.htmlDecode('<script>')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"HTML decode a string",env:"both",subCommand:[]}]},g=async t=>{let r=typeof t=="string"?new TextEncoder().encode(t):t,e=new CompressionStream("gzip"),o=e.writable.getWriter();return o.write(r.buffer),o.close(),new Response(e.readable).blob()},v=async t=>{let r=new DecompressionStream("gzip"),e=r.writable.getWriter();e.write(await t.arrayBuffer()),e.close();let o=await new Response(r.readable).arrayBuffer();return new TextDecoder().decode(o)},w=async t=>{let r=typeof t=="string"?new TextEncoder().encode(t):t,e=new CompressionStream("deflate"),o=e.writable.getWriter();return o.write(r.buffer),o.close(),new Response(e.readable).blob()},D=async t=>{let r=new DecompressionStream("deflate"),e=r.writable.getWriter();e.write(await t.arrayBuffer()),e.close();let o=await new Response(r.readable).arrayBuffer();return new TextDecoder().decode(o)},y=t=>{let r={},e="",o=[],i=256;for(let s=0;s<256;s++)r[String.fromCharCode(s)]=s;for(let s=0;s<t.length;s++){let n=t[s],l=e+n;r[l]!==void 0?e=l:(o.push(String(r[e])),r[l]=i++,e=n);}return e!==""&&o.push(String(r[e])),String.fromCharCode(...o.map(Number))},C=t=>{let r={},e=[],o=256;for(let n=0;n<256;n++)r[n]=String.fromCharCode(n);let i=t.split("").map(n=>n.charCodeAt(0)),s=r[i[0]];e.push(s);for(let n=1;n<i.length;n++){let l=i[n],c=r[l];c===void 0&&(c=s+s[0]),e.push(c),r[o++]=s+c[0],s=c;}return e.join("")},P=t=>{let r=new TextEncoder().encode(t),e="";return r.forEach(o=>e+=String.fromCharCode(o)),btoa(e)},x=t=>{let r=atob(t),e=new Uint8Array(r.length);for(let o=0;o<r.length;o++)e[o]=r.charCodeAt(o);return new TextDecoder().decode(e)},S=t=>encodeURIComponent(t),j=t=>decodeURIComponent(t),E=t=>{let r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return t.replace(/[&<>"']/g,e=>r[e]||e)},M=t=>{let r={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"};return t.replace(/&(amp|lt|gt|quot|#39);/g,(e,o)=>r[`&${o};`]||e)},z={gzip:g,gunzip:v,deflate:w,inflate:D,compress:y,decompress:C,base64Encode:P,base64Decode:x,urlEncode:S,urlDecode:j,htmlEncode:E,htmlDecode:M};dphelper?.setDescription(h,z);var q=dphelper.compress;export{q as compress};
1
+ var m={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var u={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...m},configurable:true,writable:true},version:{value:u.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var a=dphelper;Object.defineProperty(a,"setProps",{value:(t,r,e)=>{Object.defineProperty(t,r.name,e||{writable:false,configurable:false,enumerable:false}),e?.lock&&Object.freeze(t[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(t,r)=>{Object.defineProperties(a,{[t.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(e=>(Object.defineProperties(a[t.name],{[e]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,t,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(t);}});var h={name:"compress",active:true,subCommand:[{name:"gzip",version:"0.0.1",example:"dphelper.compress.gzip('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Compress data using gzip",env:"both",subCommand:[]},{name:"gunzip",version:"0.0.1",example:"dphelper.compress.gunzip(compressedData)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decompress gzip data",env:"both",subCommand:[]},{name:"deflate",version:"0.0.1",example:"dphelper.compress.deflate('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Compress data using deflate",env:"both",subCommand:[]},{name:"inflate",version:"0.0.1",example:"dphelper.compress.inflate(compressedData)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decompress deflate data",env:"both",subCommand:[]},{name:"compress",version:"0.0.1",example:"dphelper.compress.compress('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Compress data using LZW algorithm (JavaScript compatible)",env:"both",subCommand:[]},{name:"decompress",version:"0.0.1",example:"dphelper.compress.decompress(compressedString)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decompress LZW compressed data",env:"both",subCommand:[]},{name:"base64Encode",version:"0.0.1",example:"dphelper.compress.base64Encode('Hello')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Encode string to base64",env:"both",subCommand:[]},{name:"base64Decode",version:"0.0.1",example:"dphelper.compress.base64Decode('SGVsbG8=')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decode base64 string",env:"both",subCommand:[]},{name:"urlEncode",version:"0.0.1",example:"dphelper.compress.urlEncode('Hello World!')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"URL encode a string",env:"both",subCommand:[]},{name:"urlDecode",version:"0.0.1",example:"dphelper.compress.urlDecode('Hello%20World!')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"URL decode a string",env:"both",subCommand:[]},{name:"htmlEncode",version:"0.0.1",example:"dphelper.compress.htmlEncode('<script>')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"HTML encode a string",env:"both",subCommand:[]},{name:"htmlDecode",version:"0.0.1",example:"dphelper.compress.htmlDecode('<script>')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"HTML decode a string",env:"both",subCommand:[]}]},g=async t=>{let r=typeof t=="string"?new TextEncoder().encode(t):t,e=new CompressionStream("gzip"),o=e.writable.getWriter();return o.write(r.buffer),o.close(),new Response(e.readable).blob()},v=async t=>{let r=new DecompressionStream("gzip"),e=r.writable.getWriter();e.write(await t.arrayBuffer()),e.close();let o=await new Response(r.readable).arrayBuffer();return new TextDecoder().decode(o)},w=async t=>{let r=typeof t=="string"?new TextEncoder().encode(t):t,e=new CompressionStream("deflate"),o=e.writable.getWriter();return o.write(r.buffer),o.close(),new Response(e.readable).blob()},D=async t=>{let r=new DecompressionStream("deflate"),e=r.writable.getWriter();e.write(await t.arrayBuffer()),e.close();let o=await new Response(r.readable).arrayBuffer();return new TextDecoder().decode(o)},y=t=>{let r={},e="",o=[],i=256;for(let s=0;s<256;s++)r[String.fromCharCode(s)]=s;for(let s=0;s<t.length;s++){let n=t[s],l=e+n;r[l]!==void 0?e=l:(o.push(String(r[e])),r[l]=i++,e=n);}return e!==""&&o.push(String(r[e])),String.fromCharCode(...o.map(Number))},C=t=>{let r={},e=[],o=256;for(let n=0;n<256;n++)r[n]=String.fromCharCode(n);let i=t.split("").map(n=>n.charCodeAt(0)),s=r[i[0]];e.push(s);for(let n=1;n<i.length;n++){let l=i[n],c=r[l];c===void 0&&(c=s+s[0]),e.push(c),r[o++]=s+c[0],s=c;}return e.join("")},P=t=>{let r=new TextEncoder().encode(t),e="";return r.forEach(o=>e+=String.fromCharCode(o)),btoa(e)},x=t=>{let r=atob(t),e=new Uint8Array(r.length);for(let o=0;o<r.length;o++)e[o]=r.charCodeAt(o);return new TextDecoder().decode(e)},S=t=>encodeURIComponent(t),j=t=>decodeURIComponent(t),E=t=>{let r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return t.replace(/[&<>"']/g,e=>r[e]||e)},M=t=>{let r={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"};return t.replace(/&(amp|lt|gt|quot|#39);/g,(e,o)=>r[`&${o};`]||e)},z={gzip:g,gunzip:v,deflate:w,inflate:D,compress:y,decompress:C,base64Encode:P,base64Decode:x,urlEncode:S,urlDecode:j,htmlEncode:E,htmlDecode:M};dphelper?.setDescription(h,z);var q=dphelper.compress;export{q as compress};
@@ -1 +1 @@
1
- 'use strict';var s={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var c={version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...s},configurable:true,writable:true},version:{value:c.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var r=dphelper;Object.defineProperty(r,"setProps",{value:(e,t,o)=>{Object.defineProperty(e,t.name,o||{writable:false,configurable:false,enumerable:false}),o?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(r,"setDescription",{value:(e,t)=>{Object.defineProperties(r,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(o=>(Object.defineProperties(r[e.name],{[o]:{writable:false,configurable:false,enumerable:false}}),null)),r.setProps(r,e,{writable:false,configurable:false,enumerable:false}),r._list.scripts.push(e);}});var v={name:"cookie",active:true,subCommand:[{name:"set",version:"0.0.2",example:"dphelper.cookie.set({name, value, time, path = '/'})",description:"Creates a cookie with specified properties.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"get",version:"0.0.2",example:"dphelper.cookie.get(name)",description:"Retrieves the value of a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"delete",version:"0.0.2",example:"dphelper.cookie.delete(name)",description:"Deletes a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"removeAll",version:"0.0.2",example:"dphelper.cookie.removeAll()",description:"Clears all cookies.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]}]},g={set:e=>{let t=new Date;if(t.setTime(t.getTime()+3600*1e3*24*365),!e.name)return;let{name:o,value:i,time:a=e.time||t.toUTCString(),path:l=e.path||"/",sameSite:p=e.sameSite||"Lax",secure:u=e.secure??location.protocol==="https:"}=e,m=encodeURIComponent(i),d=u?"Secure":"",f=p;document.cookie=`${o}=${m}; expires=${a}; path=${l}; SameSite=${f}; ${d}`;},get:e=>{let t=document.cookie.split(";"),o=t.length;for(let i=0;i<o;i++){let a=t[i];if(!a)continue;let l=a.trim().split("=");if(e===l[0])return decodeURIComponent(l[1]||"")}return null},delete:e=>dphelper.cookie.set({name:e,value:"",time:"Thu, 01 Jan 1970 00:00:00 GMT"}),removeAll:()=>{let e=document.cookie.split(";"),t=e.length;for(let o=0;o<t;o++){let i=e[o];if(!i)continue;let a=i.indexOf("="),l=a>-1?i.slice(0,a):i;dphelper.cookie.delete(l.trim());}}};dphelper?.setDescription(v,g);var T=dphelper.cookie;exports.cookie=T;
1
+ 'use strict';var s={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var c={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...s},configurable:true,writable:true},version:{value:c.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var r=dphelper;Object.defineProperty(r,"setProps",{value:(e,t,o)=>{Object.defineProperty(e,t.name,o||{writable:false,configurable:false,enumerable:false}),o?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(r,"setDescription",{value:(e,t)=>{Object.defineProperties(r,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(o=>(Object.defineProperties(r[e.name],{[o]:{writable:false,configurable:false,enumerable:false}}),null)),r.setProps(r,e,{writable:false,configurable:false,enumerable:false}),r._list.scripts.push(e);}});var v={name:"cookie",active:true,subCommand:[{name:"set",version:"0.0.2",example:"dphelper.cookie.set({name, value, time, path = '/'})",description:"Creates a cookie with specified properties.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"get",version:"0.0.2",example:"dphelper.cookie.get(name)",description:"Retrieves the value of a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"delete",version:"0.0.2",example:"dphelper.cookie.delete(name)",description:"Deletes a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"removeAll",version:"0.0.2",example:"dphelper.cookie.removeAll()",description:"Clears all cookies.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]}]},g={set:e=>{let t=new Date;if(t.setTime(t.getTime()+3600*1e3*24*365),!e.name)return;let{name:o,value:i,time:a=e.time||t.toUTCString(),path:l=e.path||"/",sameSite:p=e.sameSite||"Lax",secure:u=e.secure??location.protocol==="https:"}=e,m=encodeURIComponent(i),d=u?"Secure":"",f=p;document.cookie=`${o}=${m}; expires=${a}; path=${l}; SameSite=${f}; ${d}`;},get:e=>{let t=document.cookie.split(";"),o=t.length;for(let i=0;i<o;i++){let a=t[i];if(!a)continue;let l=a.trim().split("=");if(e===l[0])return decodeURIComponent(l[1]||"")}return null},delete:e=>dphelper.cookie.set({name:e,value:"",time:"Thu, 01 Jan 1970 00:00:00 GMT"}),removeAll:()=>{let e=document.cookie.split(";"),t=e.length;for(let o=0;o<t;o++){let i=e[o];if(!i)continue;let a=i.indexOf("="),l=a>-1?i.slice(0,a):i;dphelper.cookie.delete(l.trim());}}};dphelper?.setDescription(v,g);var T=dphelper.cookie;exports.cookie=T;
@@ -1,16 +1,16 @@
1
1
  /// <reference path="../types/dphelper.d.ts" />
2
- export interface CookieTool {
3
- set: (pars: {
4
- name: any,
5
- value: any,
6
- time?: any,
7
- path?: string,
8
- sameSite?: string,
9
- secure?: string
10
- }) => any
11
- get: (name: string) => any
12
- delete: (name: string) => any
13
- removeAll: () => any
2
+ export interface CookieTool {
3
+ set: (pars: {
4
+ name: any,
5
+ value: any,
6
+ time?: any,
7
+ path?: string,
8
+ sameSite?: string,
9
+ secure?: string
10
+ }) => any
11
+ get: (name: string) => any
12
+ delete: (name: string) => any
13
+ removeAll: () => any
14
14
  }
15
15
 
16
16
  export const cookie: CookieTool
package/modules/cookie.js CHANGED
@@ -1 +1 @@
1
- var c={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var p={version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...c},configurable:true,writable:true},version:{value:p.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var r=dphelper;Object.defineProperty(r,"setProps",{value:(e,t,o)=>{Object.defineProperty(e,t.name,o||{writable:false,configurable:false,enumerable:false}),o?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(r,"setDescription",{value:(e,t)=>{Object.defineProperties(r,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(o=>(Object.defineProperties(r[e.name],{[o]:{writable:false,configurable:false,enumerable:false}}),null)),r.setProps(r,e,{writable:false,configurable:false,enumerable:false}),r._list.scripts.push(e);}});var g={name:"cookie",active:true,subCommand:[{name:"set",version:"0.0.2",example:"dphelper.cookie.set({name, value, time, path = '/'})",description:"Creates a cookie with specified properties.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"get",version:"0.0.2",example:"dphelper.cookie.get(name)",description:"Retrieves the value of a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"delete",version:"0.0.2",example:"dphelper.cookie.delete(name)",description:"Deletes a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"removeAll",version:"0.0.2",example:"dphelper.cookie.removeAll()",description:"Clears all cookies.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]}]},k={set:e=>{let t=new Date;if(t.setTime(t.getTime()+3600*1e3*24*365),!e.name)return;let{name:o,value:i,time:a=e.time||t.toUTCString(),path:l=e.path||"/",sameSite:u=e.sameSite||"Lax",secure:m=e.secure??location.protocol==="https:"}=e,d=encodeURIComponent(i),f=m?"Secure":"",b=u;document.cookie=`${o}=${d}; expires=${a}; path=${l}; SameSite=${b}; ${f}`;},get:e=>{let t=document.cookie.split(";"),o=t.length;for(let i=0;i<o;i++){let a=t[i];if(!a)continue;let l=a.trim().split("=");if(e===l[0])return decodeURIComponent(l[1]||"")}return null},delete:e=>dphelper.cookie.set({name:e,value:"",time:"Thu, 01 Jan 1970 00:00:00 GMT"}),removeAll:()=>{let e=document.cookie.split(";"),t=e.length;for(let o=0;o<t;o++){let i=e[o];if(!i)continue;let a=i.indexOf("="),l=a>-1?i.slice(0,a):i;dphelper.cookie.delete(l.trim());}}};dphelper?.setDescription(g,k);var $=dphelper.cookie;export{$ as cookie};
1
+ var c={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var p={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...c},configurable:true,writable:true},version:{value:p.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var r=dphelper;Object.defineProperty(r,"setProps",{value:(e,t,o)=>{Object.defineProperty(e,t.name,o||{writable:false,configurable:false,enumerable:false}),o?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(r,"setDescription",{value:(e,t)=>{Object.defineProperties(r,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(o=>(Object.defineProperties(r[e.name],{[o]:{writable:false,configurable:false,enumerable:false}}),null)),r.setProps(r,e,{writable:false,configurable:false,enumerable:false}),r._list.scripts.push(e);}});var g={name:"cookie",active:true,subCommand:[{name:"set",version:"0.0.2",example:"dphelper.cookie.set({name, value, time, path = '/'})",description:"Creates a cookie with specified properties.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"get",version:"0.0.2",example:"dphelper.cookie.get(name)",description:"Retrieves the value of a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"delete",version:"0.0.2",example:"dphelper.cookie.delete(name)",description:"Deletes a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"removeAll",version:"0.0.2",example:"dphelper.cookie.removeAll()",description:"Clears all cookies.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]}]},k={set:e=>{let t=new Date;if(t.setTime(t.getTime()+3600*1e3*24*365),!e.name)return;let{name:o,value:i,time:a=e.time||t.toUTCString(),path:l=e.path||"/",sameSite:u=e.sameSite||"Lax",secure:m=e.secure??location.protocol==="https:"}=e,d=encodeURIComponent(i),f=m?"Secure":"",b=u;document.cookie=`${o}=${d}; expires=${a}; path=${l}; SameSite=${b}; ${f}`;},get:e=>{let t=document.cookie.split(";"),o=t.length;for(let i=0;i<o;i++){let a=t[i];if(!a)continue;let l=a.trim().split("=");if(e===l[0])return decodeURIComponent(l[1]||"")}return null},delete:e=>dphelper.cookie.set({name:e,value:"",time:"Thu, 01 Jan 1970 00:00:00 GMT"}),removeAll:()=>{let e=document.cookie.split(";"),t=e.length;for(let o=0;o<t;o++){let i=e[o];if(!i)continue;let a=i.indexOf("="),l=a>-1?i.slice(0,a):i;dphelper.cookie.delete(l.trim());}}};dphelper?.setDescription(g,k);var $=dphelper.cookie;export{$ as cookie};
@@ -1,4 +1,4 @@
1
- 'use strict';var b={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var p={version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...b},configurable:true,writable:true},version:{value:p.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var s=dphelper;Object.defineProperty(s,"setProps",{value:(e,r,t)=>{Object.defineProperty(e,r.name,t||{writable:false,configurable:false,enumerable:false}),t?.lock&&Object.freeze(e[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(e,r)=>{Object.defineProperties(s,{[e.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(t=>(Object.defineProperties(s[e.name],{[t]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,e,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(e);}});var v={name:"coords",active:true,subCommand:[{name:"degreesToRadians",version:"0.0.2",example:"dphelper.coords.degreesToRadians(45)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert degrees to radians",env:"client",subCommand:[]},{name:"latToMeters",version:"0.0.2",example:"dphelper.coords.latToMeters([40.689202777778, -74.044219444444])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert latitude to meters",env:"client",subCommand:[]},{name:"toVector",version:"0.0.2",example:"dphelper.coords.toVector([40.689202777778, -74.044219444444, 1])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert coordinates to vector",env:"client",subCommand:[]},{name:"convertToDecDegrees",version:"0.0.2",example:"dphelper.coords.convertToDecDegrees([39, 5, 59, 'N'])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert coordinates to decimal degrees",env:"client",subCommand:[]},{name:"distance",version:"0.0.2",example:"dphelper.coords.distance([40.718788808171105, -74.0114768663747],[38.909309636475875, -77.01712459058946])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:`
1
+ 'use strict';var b={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var p={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...b},configurable:true,writable:true},version:{value:p.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var s=dphelper;Object.defineProperty(s,"setProps",{value:(e,r,t)=>{Object.defineProperty(e,r.name,t||{writable:false,configurable:false,enumerable:false}),t?.lock&&Object.freeze(e[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(e,r)=>{Object.defineProperties(s,{[e.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(t=>(Object.defineProperties(s[e.name],{[t]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,e,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(e);}});var v={name:"coords",active:true,subCommand:[{name:"degreesToRadians",version:"0.0.2",example:"dphelper.coords.degreesToRadians(45)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert degrees to radians",env:"client",subCommand:[]},{name:"latToMeters",version:"0.0.2",example:"dphelper.coords.latToMeters([40.689202777778, -74.044219444444])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert latitude to meters",env:"client",subCommand:[]},{name:"toVector",version:"0.0.2",example:"dphelper.coords.toVector([40.689202777778, -74.044219444444, 1])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert coordinates to vector",env:"client",subCommand:[]},{name:"convertToDecDegrees",version:"0.0.2",example:"dphelper.coords.convertToDecDegrees([39, 5, 59, 'N'])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert coordinates to decimal degrees",env:"client",subCommand:[]},{name:"distance",version:"0.0.2",example:"dphelper.coords.distance([40.718788808171105, -74.0114768663747],[38.909309636475875, -77.01712459058946])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:`
2
2
  Haversine formula:
3
3
  a = sin\xB2(\u0394\u03C6/2) + cos \u03C61 \u22C5 cos \u03C62 \u22C5 sin\xB2(\u0394\u03BB/2)
4
4
  c = 2 \u22C5 atan2( \u221Aa, \u221A(1-a) )
@@ -1,12 +1,12 @@
1
1
  /// <reference path="../types/dphelper.d.ts" />
2
- export interface CoordsTool {
3
- degreesToRadians: (degrees: any) => any
4
- latToMeters: (points: any) => any
5
- toVector: (points: any) => any
6
- convertToDecDegrees: (deg: any, minutes: any, sec: any, direction: any) => any
7
- distance: (point1: any, point2: any) => any
8
- polarToCartesian: (centerX: any, centerY: any, radius: any, angleInDegrees: any) => any
9
- mapDegreesToPixels: (degree: number, minDegree: number, maxDegree: number, minPixel: number, maxPixel: number, padding: number) => number
2
+ export interface CoordsTool {
3
+ degreesToRadians: (degrees: any) => any
4
+ latToMeters: (points: any) => any
5
+ toVector: (points: any) => any
6
+ convertToDecDegrees: (deg: any, minutes: any, sec: any, direction: any) => any
7
+ distance: (point1: any, point2: any) => any
8
+ polarToCartesian: (centerX: any, centerY: any, radius: any, angleInDegrees: any) => any
9
+ mapDegreesToPixels: (degree: number, minDegree: number, maxDegree: number, minPixel: number, maxPixel: number, padding: number) => number
10
10
  }
11
11
 
12
12
  export const coords: CoordsTool
package/modules/coords.js CHANGED
@@ -1,4 +1,4 @@
1
- var p={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var h={version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...p},configurable:true,writable:true},version:{value:h.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var s=dphelper;Object.defineProperty(s,"setProps",{value:(e,r,t)=>{Object.defineProperty(e,r.name,t||{writable:false,configurable:false,enumerable:false}),t?.lock&&Object.freeze(e[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(e,r)=>{Object.defineProperties(s,{[e.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(t=>(Object.defineProperties(s[e.name],{[t]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,e,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(e);}});var g={name:"coords",active:true,subCommand:[{name:"degreesToRadians",version:"0.0.2",example:"dphelper.coords.degreesToRadians(45)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert degrees to radians",env:"client",subCommand:[]},{name:"latToMeters",version:"0.0.2",example:"dphelper.coords.latToMeters([40.689202777778, -74.044219444444])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert latitude to meters",env:"client",subCommand:[]},{name:"toVector",version:"0.0.2",example:"dphelper.coords.toVector([40.689202777778, -74.044219444444, 1])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert coordinates to vector",env:"client",subCommand:[]},{name:"convertToDecDegrees",version:"0.0.2",example:"dphelper.coords.convertToDecDegrees([39, 5, 59, 'N'])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert coordinates to decimal degrees",env:"client",subCommand:[]},{name:"distance",version:"0.0.2",example:"dphelper.coords.distance([40.718788808171105, -74.0114768663747],[38.909309636475875, -77.01712459058946])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:`
1
+ var p={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var h={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...p},configurable:true,writable:true},version:{value:h.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var s=dphelper;Object.defineProperty(s,"setProps",{value:(e,r,t)=>{Object.defineProperty(e,r.name,t||{writable:false,configurable:false,enumerable:false}),t?.lock&&Object.freeze(e[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(e,r)=>{Object.defineProperties(s,{[e.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(t=>(Object.defineProperties(s[e.name],{[t]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,e,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(e);}});var g={name:"coords",active:true,subCommand:[{name:"degreesToRadians",version:"0.0.2",example:"dphelper.coords.degreesToRadians(45)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert degrees to radians",env:"client",subCommand:[]},{name:"latToMeters",version:"0.0.2",example:"dphelper.coords.latToMeters([40.689202777778, -74.044219444444])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert latitude to meters",env:"client",subCommand:[]},{name:"toVector",version:"0.0.2",example:"dphelper.coords.toVector([40.689202777778, -74.044219444444, 1])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert coordinates to vector",env:"client",subCommand:[]},{name:"convertToDecDegrees",version:"0.0.2",example:"dphelper.coords.convertToDecDegrees([39, 5, 59, 'N'])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert coordinates to decimal degrees",env:"client",subCommand:[]},{name:"distance",version:"0.0.2",example:"dphelper.coords.distance([40.718788808171105, -74.0114768663747],[38.909309636475875, -77.01712459058946])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:`
2
2
  Haversine formula:
3
3
  a = sin\xB2(\u0394\u03C6/2) + cos \u03C61 \u22C5 cos \u03C62 \u22C5 sin\xB2(\u0394\u03BB/2)
4
4
  c = 2 \u22C5 atan2( \u221Aa, \u221A(1-a) )
@@ -1 +1 @@
1
- 'use strict';var s={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var e={codeName:"dphelper",version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...s},configurable:true,writable:true},version:{value:e.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var o=dphelper;Object.defineProperty(o,"setProps",{value:(t,r,l)=>{Object.defineProperty(t,r.name,l||{writable:false,configurable:false,enumerable:false}),l?.lock&&Object.freeze(t[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(t,r)=>{Object.defineProperties(o,{[t.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(l=>(Object.defineProperties(o[t.name],{[l]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,t,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(t);}});var c={name:"credits",active:true,subCommand:[]},p=()=>{console.groupCollapsed(`%c${e.codeName} v${e.version}%c`,"color:orange",""),console.debug(`%c${e.codeName} v${e.version}%c by Dario Passariello started`,"color:orange",""),console.debug(`name: %c${e.codeName}`,"color:orange",""),console.debug(`version: %c${e.version}`,"color:orange",""),console.groupEnd();},u=dphelper;u?.setDescription?.(c,p);var O=dphelper.credits;exports.credits=O;
1
+ 'use strict';var s={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var e={codeName:"dphelper",version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...s},configurable:true,writable:true},version:{value:e.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var o=dphelper;Object.defineProperty(o,"setProps",{value:(t,r,l)=>{Object.defineProperty(t,r.name,l||{writable:false,configurable:false,enumerable:false}),l?.lock&&Object.freeze(t[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(t,r)=>{Object.defineProperties(o,{[t.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(l=>(Object.defineProperties(o[t.name],{[l]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,t,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(t);}});var c={name:"credits",active:true,subCommand:[]},p=()=>{console.groupCollapsed(`%c${e.codeName} v${e.version}%c`,"color:orange",""),console.debug(`%c${e.codeName} v${e.version}%c by Dario Passariello started`,"color:orange",""),console.debug(`name: %c${e.codeName}`,"color:orange",""),console.debug(`version: %c${e.version}`,"color:orange",""),console.groupEnd();},u=dphelper;u?.setDescription?.(c,p);var O=dphelper.credits;exports.credits=O;
@@ -1,15 +1,15 @@
1
1
  /// <reference path="../types/dphelper.d.ts" />
2
- export interface Credits {
3
- name: string
4
- version: string
5
- description: string
6
- license: string
7
- author: {
8
- name: string
9
- email: string
10
- }
11
- }
12
-
2
+ export interface Credits {
3
+ name: string
4
+ version: string
5
+ description: string
6
+ license: string
7
+ author: {
8
+ name: string
9
+ email: string
10
+ }
11
+ }
12
+
13
13
  type CreditsTool = (props: Credits) => void
14
14
 
15
15
  export const credits: CreditsTool
@@ -1 +1 @@
1
- var i={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var e={codeName:"dphelper",version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...i},configurable:true,writable:true},version:{value:e.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var o=dphelper;Object.defineProperty(o,"setProps",{value:(t,r,l)=>{Object.defineProperty(t,r.name,l||{writable:false,configurable:false,enumerable:false}),l?.lock&&Object.freeze(t[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(t,r)=>{Object.defineProperties(o,{[t.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(l=>(Object.defineProperties(o[t.name],{[l]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,t,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(t);}});var p={name:"credits",active:true,subCommand:[]},u=()=>{console.groupCollapsed(`%c${e.codeName} v${e.version}%c`,"color:orange",""),console.debug(`%c${e.codeName} v${e.version}%c by Dario Passariello started`,"color:orange",""),console.debug(`name: %c${e.codeName}`,"color:orange",""),console.debug(`version: %c${e.version}`,"color:orange",""),console.groupEnd();},b=dphelper;b?.setDescription?.(p,u);var k=dphelper.credits;export{k as credits};
1
+ var i={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var e={codeName:"dphelper",version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...i},configurable:true,writable:true},version:{value:e.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var o=dphelper;Object.defineProperty(o,"setProps",{value:(t,r,l)=>{Object.defineProperty(t,r.name,l||{writable:false,configurable:false,enumerable:false}),l?.lock&&Object.freeze(t[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(t,r)=>{Object.defineProperties(o,{[t.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(l=>(Object.defineProperties(o[t.name],{[l]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,t,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(t);}});var p={name:"credits",active:true,subCommand:[]},u=()=>{console.groupCollapsed(`%c${e.codeName} v${e.version}%c`,"color:orange",""),console.debug(`%c${e.codeName} v${e.version}%c by Dario Passariello started`,"color:orange",""),console.debug(`name: %c${e.codeName}`,"color:orange",""),console.debug(`version: %c${e.version}`,"color:orange",""),console.groupEnd();},b=dphelper;b?.setDescription?.(p,u);var k=dphelper.credits;export{k as credits};
package/modules/date.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var d={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var c={version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...d},configurable:true,writable:true},version:{value:c.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,t,a)=>{Object.defineProperty(e,t.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,t)=>{Object.defineProperties(i,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(i[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var m={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]};var b={name:"date",active:true,subCommand:[{name:"toIso",version:"0.0.2",example:"dphelper.date.toIso(value, 'en')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to ISO format.",env:"both",subCommand:[]},{name:"toMMDDYYYY",version:"0.0.2",example:"dphelper.date.toMMDDYYYY(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to MMDDYYYY format.",env:"both",subCommand:[]},{name:"toYYYYMMDD",version:"0.0.2",example:"dphelper.date.toYYYYMMDD(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to YYYYMMDD format.",env:"both",subCommand:[]},{name:"toHuman",version:"0.0.2",example:"dphelper.date.toHuman(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to a human-readable format.",env:"both",subCommand:[]},{name:"convert",version:"0.0.2",example:"dphelper.date.convert(value, format)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to a specified format.",env:"both",subCommand:[]},{name:"iso2Epoch",version:"0.0.2",example:"dphelper.date.iso2Epoch(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts an ISO date value to epoch time.",env:"both",subCommand:[]},{name:"localIsoTime",version:"0.0.2",example:"dphelper.date.localIsoTime(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the local ISO time for a given date value.",env:"both",subCommand:[]},{name:"utc",version:"0.0.2",example:"dphelper.date.utc()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current UTC time.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.date.parse(value, '/')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Parses a date value with a specified separator.",env:"both",subCommand:[]},{name:"year",version:"0.0.2",example:"dphelper.date.year()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current year.",env:"both",subCommand:[]},{name:"addDays",version:"0.0.2",example:"dphelper.date.addDays(date, days)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Adds a specified number of days to a date.",env:"both",subCommand:[]},{name:"dateTimeToString",version:"0.0.2",example:"dphelper.date.dateTimeToString(dateObject)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date object to a string.",env:"both",subCommand:[]},{name:"isoToHuman",version:"0.0.2",example:"dphelper.date.isoToHuman(value, '@')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts an ISO date value to a human-readable format with a specified symbol.",env:"both",subCommand:[]},{name:"fullDate",version:"0.0.2",example:"dphelper.date.fullDate()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the full date and time in the format DD-MM-YYYY HH:MM:SS.",env:"both",subCommand:[]},{name:"epoch",version:"0.0.2",example:"dphelper.date.epoch()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current epoch time.",env:"both",subCommand:[]},{name:"diffInDays",version:"0.0.2",example:"dphelper.date.diffInDays(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in days between two dates.",env:"both",subCommand:[]},{name:"diffInWeeks",version:"0.0.2",example:"dphelper.date.diffInWeeks(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in weeks between two dates.",env:"both",subCommand:[]},{name:"diffInMonths",version:"0.0.2",example:"dphelper.date.diffInMonths(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in months between two dates.",env:"both",subCommand:[]},{name:"diffInYears",version:"0.0.2",example:"dphelper.date.diffInYears(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in years between two dates.",env:"both",subCommand:[]},{name:"dateToYMD",version:"0.0.2",example:"dphelper.date.dateToYMD(date)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date to the format YYYY-MM-DD.",env:"both",subCommand:[]},{name:"collection",version:"0.0.2",example:"dphelper.date.collection()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets various date representations based on the type and locale.",env:"both",subCommand:[]},{name:"timeZones",version:"0.0.2",example:"dphelper.date.timeZones()",author:"Dario Passariello",creationDate:"20240901",lastMod:"20260220",type:"function",active:true,description:"Returns an array of all supported timezones.",env:"both",subCommand:[]}]},g={days:(e="en")=>({en:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],it:["luned\xEC","marted\xEC","mercoled\xEC","gioved\xEC","venerd\xEC","sabato","domenica"]})[e],months:(e="en")=>m[e],year:()=>new Date().getFullYear(),toIso:(e,t="en")=>{e||(e="");let a=new Date(e);return String(a)==="Invalid Date"?null:new Intl.DateTimeFormat(t,{year:"numeric",month:"long",day:"numeric"}).format(a)},toMMDDYYYY:e=>{try{let t=new Date(e);return isNaN(t.getTime())?"":`0${t.getMonth()+1}`.slice(-2)+""+`0${t.getDate()}`.slice(-2)+t.getFullYear()}catch{return ""}},toYYYYMMDD:e=>{if(e)return e.toISOString().split("T")[0].replaceAll("-","")},toHuman:e=>{let t={weekday:"long",year:"numeric",month:"long",day:"numeric"};return e.toLocaleDateString(void 0,t)},convert:(e,t)=>{if(!e)return null;t||(t=dphelper.date.months("en"));let a=e.substring(0,2).replace("0",""),o=e.substring(2,4),n=e.substring(e.length-4);return `${o} ${t[Number(a)-1]} ${n}`},iso2Epoch:e=>(e||(e=""),new Date(e).getTime()),localIsoTime:e=>{e||(e=new Date);let t=new Date(e);if(isNaN(t.getTime()))return "";let a=t.getTimezoneOffset()*6e4;return new Date(Date.now()-a).toISOString().slice(0,-1)},utc:()=>new Date().toUTCString(),parse:(e,t="/")=>{if(!e)return null;let a=e.substring(0,2),o=e.substring(2,4),n=e.substring(4,8);return a+t+o+t+n},addDays:(e,t)=>{let a=new Date(Number(e));return a.setDate(e.getDate()+t),a},dateTimeToString:e=>{try{return `${e.getFullYear()}${e.getMonth().toString().length>1?e.getMonth()+1:`0${e.getMonth()+1}`}
1
+ 'use strict';var d={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var c={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...d},configurable:true,writable:true},version:{value:c.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,t,a)=>{Object.defineProperty(e,t.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,t)=>{Object.defineProperties(i,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(i[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var m={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]};var b={name:"date",active:true,subCommand:[{name:"toIso",version:"0.0.2",example:"dphelper.date.toIso(value, 'en')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to ISO format.",env:"both",subCommand:[]},{name:"toMMDDYYYY",version:"0.0.2",example:"dphelper.date.toMMDDYYYY(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to MMDDYYYY format.",env:"both",subCommand:[]},{name:"toYYYYMMDD",version:"0.0.2",example:"dphelper.date.toYYYYMMDD(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to YYYYMMDD format.",env:"both",subCommand:[]},{name:"toHuman",version:"0.0.2",example:"dphelper.date.toHuman(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to a human-readable format.",env:"both",subCommand:[]},{name:"convert",version:"0.0.2",example:"dphelper.date.convert(value, format)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to a specified format.",env:"both",subCommand:[]},{name:"iso2Epoch",version:"0.0.2",example:"dphelper.date.iso2Epoch(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts an ISO date value to epoch time.",env:"both",subCommand:[]},{name:"localIsoTime",version:"0.0.2",example:"dphelper.date.localIsoTime(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the local ISO time for a given date value.",env:"both",subCommand:[]},{name:"utc",version:"0.0.2",example:"dphelper.date.utc()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current UTC time.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.date.parse(value, '/')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Parses a date value with a specified separator.",env:"both",subCommand:[]},{name:"year",version:"0.0.2",example:"dphelper.date.year()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current year.",env:"both",subCommand:[]},{name:"addDays",version:"0.0.2",example:"dphelper.date.addDays(date, days)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Adds a specified number of days to a date.",env:"both",subCommand:[]},{name:"dateTimeToString",version:"0.0.2",example:"dphelper.date.dateTimeToString(dateObject)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date object to a string.",env:"both",subCommand:[]},{name:"isoToHuman",version:"0.0.2",example:"dphelper.date.isoToHuman(value, '@')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts an ISO date value to a human-readable format with a specified symbol.",env:"both",subCommand:[]},{name:"fullDate",version:"0.0.2",example:"dphelper.date.fullDate()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the full date and time in the format DD-MM-YYYY HH:MM:SS.",env:"both",subCommand:[]},{name:"epoch",version:"0.0.2",example:"dphelper.date.epoch()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current epoch time.",env:"both",subCommand:[]},{name:"diffInDays",version:"0.0.2",example:"dphelper.date.diffInDays(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in days between two dates.",env:"both",subCommand:[]},{name:"diffInWeeks",version:"0.0.2",example:"dphelper.date.diffInWeeks(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in weeks between two dates.",env:"both",subCommand:[]},{name:"diffInMonths",version:"0.0.2",example:"dphelper.date.diffInMonths(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in months between two dates.",env:"both",subCommand:[]},{name:"diffInYears",version:"0.0.2",example:"dphelper.date.diffInYears(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in years between two dates.",env:"both",subCommand:[]},{name:"dateToYMD",version:"0.0.2",example:"dphelper.date.dateToYMD(date)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date to the format YYYY-MM-DD.",env:"both",subCommand:[]},{name:"collection",version:"0.0.2",example:"dphelper.date.collection()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets various date representations based on the type and locale.",env:"both",subCommand:[]},{name:"timeZones",version:"0.0.2",example:"dphelper.date.timeZones()",author:"Dario Passariello",creationDate:"20240901",lastMod:"20260220",type:"function",active:true,description:"Returns an array of all supported timezones.",env:"both",subCommand:[]}]},g={days:(e="en")=>({en:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],it:["luned\xEC","marted\xEC","mercoled\xEC","gioved\xEC","venerd\xEC","sabato","domenica"]})[e],months:(e="en")=>m[e],year:()=>new Date().getFullYear(),toIso:(e,t="en")=>{e||(e="");let a=new Date(e);return String(a)==="Invalid Date"?null:new Intl.DateTimeFormat(t,{year:"numeric",month:"long",day:"numeric"}).format(a)},toMMDDYYYY:e=>{try{let t=new Date(e);return isNaN(t.getTime())?"":`0${t.getMonth()+1}`.slice(-2)+""+`0${t.getDate()}`.slice(-2)+t.getFullYear()}catch{return ""}},toYYYYMMDD:e=>{if(e)return e.toISOString().split("T")[0].replaceAll("-","")},toHuman:e=>{let t={weekday:"long",year:"numeric",month:"long",day:"numeric"};return e.toLocaleDateString(void 0,t)},convert:(e,t)=>{if(!e)return null;t||(t=dphelper.date.months("en"));let a=e.substring(0,2).replace("0",""),o=e.substring(2,4),n=e.substring(e.length-4);return `${o} ${t[Number(a)-1]} ${n}`},iso2Epoch:e=>(e||(e=""),new Date(e).getTime()),localIsoTime:e=>{e||(e=new Date);let t=new Date(e);if(isNaN(t.getTime()))return "";let a=t.getTimezoneOffset()*6e4;return new Date(Date.now()-a).toISOString().slice(0,-1)},utc:()=>new Date().toUTCString(),parse:(e,t="/")=>{if(!e)return null;let a=e.substring(0,2),o=e.substring(2,4),n=e.substring(4,8);return a+t+o+t+n},addDays:(e,t)=>{let a=new Date(Number(e));return a.setDate(e.getDate()+t),a},dateTimeToString:e=>{try{return `${e.getFullYear()}${e.getMonth().toString().length>1?e.getMonth()+1:`0${e.getMonth()+1}`}
2
2
  ${e.getDate().toString().length>1?e.getDate():`0${e.getDate()}`}_${e.getHours()}${e.getMinutes()}${e.getSeconds()}`}catch(t){return console.error(t),e}},isoToHuman:(e,t="@")=>{if(!e)return null;let a=dphelper.date.months("en"),o=new Date(e),n=o.getFullYear(),s=e.split("T")[1].split(":").slice(0,2).join(":"),r=(o.getMonth()+1).toString(),l=o.getDate().toString();return l.length<2&&(l=`0${l}`),r.length<2&&(r=`0${r}`),`${l} ${a[Number(r)-1]} ${n} ${t} ${s}`},fullDate:()=>{let e=new Date,t=Number(e.getDate()),a=Number(e.getMonth()+1),o=Number(e.getFullYear()),n=Number(e.getHours()),s=Number(e.getMinutes()),r=Number(e.getSeconds());return (t<10?`0${t}`:t)+"-"+(a<10?`0${a}`:a)+"-"+o+" "+(n<10?`0${n}`:n)+":"+(s<10?`0${s}`:s)+":"+(r<10?`0${r}`:r)},epoch:()=>Date.now(),diffInDays:(e,t)=>{let a=t.getTime(),o=e.getTime();return Math.floor((a-o)/(24*3600*1e3))},diffInWeeks:(e,t)=>{let a=t.getTime(),o=e.getTime();return Number(Number.parseInt(String((a-o)/(24*3600*1e3*7)),10))},diffInMonths:(e,t)=>{let a=e.getFullYear(),o=t.getFullYear(),n=e.getMonth();return t.getMonth()+12*o-(n+12*a)},diffInYears:(e,t)=>t.getFullYear()-e.getFullYear(),dateToYMD:e=>{let t=e.getDate(),a=e.getMonth()+1;return `${e.getFullYear()}-${a<=9?`0${a}`:a}-${t<=9?`0${t}`:t}`},collection:({date:e=new Date,type:t="",locale:a="en-US"})=>{!e&&t&&a&&console.debug(`
3
3
  "toDateString" -> Tue Jan 02 2024
4
4
  "toISOString" -> 2024-01-02T18:44:43.590Z
package/modules/date.d.ts CHANGED
@@ -1,29 +1,29 @@
1
1
  /// <reference path="../types/dphelper.d.ts" />
2
- export interface DateTool {
3
- days: (lang?: string) => string[]
4
- months: (lang?: string) => string[]
5
- year: () => number
6
- toIso: (value: any, int?: string) => string | null
7
- toMMDDYYYY: (value: any) => string
8
- toYYYYMMDD: (value: any) => string | undefined
9
- toHuman: (value: any) => string
10
- convert: (value: any, format: string[]) => string | null
11
- iso2Epoch: (value: any) => number
12
- localIsoTime: (value: any) => string
13
- utc: () => string
14
- parse: (value: any, separator?: string) => string | null
15
- addDays: (date: any, days: number) => Date
16
- dateTimeToString: (dateObject: any) => string
17
- isoToHuman: (value: any, symbol?: string) => string | null
18
- fullDate: () => string
19
- epoch: () => number
20
- diffInDays: (d1: any, d2: any) => number
21
- diffInWeeks: (d1: any, d2: any) => number
22
- diffInMonths: (d1: any, d2: any) => number
23
- diffInYears: (d1: any, d2: any) => number
24
- dateToYMD: (date: any) => string
25
- collection: (params: { date?: Date; type: string; locale?: string }) => string | undefined
26
- timeZones: () => string[]
2
+ export interface DateTool {
3
+ days: (lang?: string) => string[]
4
+ months: (lang?: string) => string[]
5
+ year: () => number
6
+ toIso: (value: any, int?: string) => string | null
7
+ toMMDDYYYY: (value: any) => string
8
+ toYYYYMMDD: (value: any) => string | undefined
9
+ toHuman: (value: any) => string
10
+ convert: (value: any, format: string[]) => string | null
11
+ iso2Epoch: (value: any) => number
12
+ localIsoTime: (value: any) => string
13
+ utc: () => string
14
+ parse: (value: any, separator?: string) => string | null
15
+ addDays: (date: any, days: number) => Date
16
+ dateTimeToString: (dateObject: any) => string
17
+ isoToHuman: (value: any, symbol?: string) => string | null
18
+ fullDate: () => string
19
+ epoch: () => number
20
+ diffInDays: (d1: any, d2: any) => number
21
+ diffInWeeks: (d1: any, d2: any) => number
22
+ diffInMonths: (d1: any, d2: any) => number
23
+ diffInYears: (d1: any, d2: any) => number
24
+ dateToYMD: (date: any) => string
25
+ collection: (params: { date?: Date; type: string; locale?: string }) => string | undefined
26
+ timeZones: () => string[]
27
27
  }
28
28
 
29
29
  export const date: DateTool
package/modules/date.js CHANGED
@@ -1,4 +1,4 @@
1
- var c={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var m={version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...c},configurable:true,writable:true},version:{value:m.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,t,a)=>{Object.defineProperty(e,t.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,t)=>{Object.defineProperties(i,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(i[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var p={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]};var g={name:"date",active:true,subCommand:[{name:"toIso",version:"0.0.2",example:"dphelper.date.toIso(value, 'en')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to ISO format.",env:"both",subCommand:[]},{name:"toMMDDYYYY",version:"0.0.2",example:"dphelper.date.toMMDDYYYY(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to MMDDYYYY format.",env:"both",subCommand:[]},{name:"toYYYYMMDD",version:"0.0.2",example:"dphelper.date.toYYYYMMDD(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to YYYYMMDD format.",env:"both",subCommand:[]},{name:"toHuman",version:"0.0.2",example:"dphelper.date.toHuman(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to a human-readable format.",env:"both",subCommand:[]},{name:"convert",version:"0.0.2",example:"dphelper.date.convert(value, format)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to a specified format.",env:"both",subCommand:[]},{name:"iso2Epoch",version:"0.0.2",example:"dphelper.date.iso2Epoch(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts an ISO date value to epoch time.",env:"both",subCommand:[]},{name:"localIsoTime",version:"0.0.2",example:"dphelper.date.localIsoTime(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the local ISO time for a given date value.",env:"both",subCommand:[]},{name:"utc",version:"0.0.2",example:"dphelper.date.utc()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current UTC time.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.date.parse(value, '/')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Parses a date value with a specified separator.",env:"both",subCommand:[]},{name:"year",version:"0.0.2",example:"dphelper.date.year()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current year.",env:"both",subCommand:[]},{name:"addDays",version:"0.0.2",example:"dphelper.date.addDays(date, days)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Adds a specified number of days to a date.",env:"both",subCommand:[]},{name:"dateTimeToString",version:"0.0.2",example:"dphelper.date.dateTimeToString(dateObject)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date object to a string.",env:"both",subCommand:[]},{name:"isoToHuman",version:"0.0.2",example:"dphelper.date.isoToHuman(value, '@')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts an ISO date value to a human-readable format with a specified symbol.",env:"both",subCommand:[]},{name:"fullDate",version:"0.0.2",example:"dphelper.date.fullDate()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the full date and time in the format DD-MM-YYYY HH:MM:SS.",env:"both",subCommand:[]},{name:"epoch",version:"0.0.2",example:"dphelper.date.epoch()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current epoch time.",env:"both",subCommand:[]},{name:"diffInDays",version:"0.0.2",example:"dphelper.date.diffInDays(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in days between two dates.",env:"both",subCommand:[]},{name:"diffInWeeks",version:"0.0.2",example:"dphelper.date.diffInWeeks(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in weeks between two dates.",env:"both",subCommand:[]},{name:"diffInMonths",version:"0.0.2",example:"dphelper.date.diffInMonths(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in months between two dates.",env:"both",subCommand:[]},{name:"diffInYears",version:"0.0.2",example:"dphelper.date.diffInYears(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in years between two dates.",env:"both",subCommand:[]},{name:"dateToYMD",version:"0.0.2",example:"dphelper.date.dateToYMD(date)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date to the format YYYY-MM-DD.",env:"both",subCommand:[]},{name:"collection",version:"0.0.2",example:"dphelper.date.collection()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets various date representations based on the type and locale.",env:"both",subCommand:[]},{name:"timeZones",version:"0.0.2",example:"dphelper.date.timeZones()",author:"Dario Passariello",creationDate:"20240901",lastMod:"20260220",type:"function",active:true,description:"Returns an array of all supported timezones.",env:"both",subCommand:[]}]},D={days:(e="en")=>({en:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],it:["luned\xEC","marted\xEC","mercoled\xEC","gioved\xEC","venerd\xEC","sabato","domenica"]})[e],months:(e="en")=>p[e],year:()=>new Date().getFullYear(),toIso:(e,t="en")=>{e||(e="");let a=new Date(e);return String(a)==="Invalid Date"?null:new Intl.DateTimeFormat(t,{year:"numeric",month:"long",day:"numeric"}).format(a)},toMMDDYYYY:e=>{try{let t=new Date(e);return isNaN(t.getTime())?"":`0${t.getMonth()+1}`.slice(-2)+""+`0${t.getDate()}`.slice(-2)+t.getFullYear()}catch{return ""}},toYYYYMMDD:e=>{if(e)return e.toISOString().split("T")[0].replaceAll("-","")},toHuman:e=>{let t={weekday:"long",year:"numeric",month:"long",day:"numeric"};return e.toLocaleDateString(void 0,t)},convert:(e,t)=>{if(!e)return null;t||(t=dphelper.date.months("en"));let a=e.substring(0,2).replace("0",""),o=e.substring(2,4),n=e.substring(e.length-4);return `${o} ${t[Number(a)-1]} ${n}`},iso2Epoch:e=>(e||(e=""),new Date(e).getTime()),localIsoTime:e=>{e||(e=new Date);let t=new Date(e);if(isNaN(t.getTime()))return "";let a=t.getTimezoneOffset()*6e4;return new Date(Date.now()-a).toISOString().slice(0,-1)},utc:()=>new Date().toUTCString(),parse:(e,t="/")=>{if(!e)return null;let a=e.substring(0,2),o=e.substring(2,4),n=e.substring(4,8);return a+t+o+t+n},addDays:(e,t)=>{let a=new Date(Number(e));return a.setDate(e.getDate()+t),a},dateTimeToString:e=>{try{return `${e.getFullYear()}${e.getMonth().toString().length>1?e.getMonth()+1:`0${e.getMonth()+1}`}
1
+ var c={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var m={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...c},configurable:true,writable:true},version:{value:m.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,t,a)=>{Object.defineProperty(e,t.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,t)=>{Object.defineProperties(i,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(i[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var p={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]};var g={name:"date",active:true,subCommand:[{name:"toIso",version:"0.0.2",example:"dphelper.date.toIso(value, 'en')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to ISO format.",env:"both",subCommand:[]},{name:"toMMDDYYYY",version:"0.0.2",example:"dphelper.date.toMMDDYYYY(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to MMDDYYYY format.",env:"both",subCommand:[]},{name:"toYYYYMMDD",version:"0.0.2",example:"dphelper.date.toYYYYMMDD(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to YYYYMMDD format.",env:"both",subCommand:[]},{name:"toHuman",version:"0.0.2",example:"dphelper.date.toHuman(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to a human-readable format.",env:"both",subCommand:[]},{name:"convert",version:"0.0.2",example:"dphelper.date.convert(value, format)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to a specified format.",env:"both",subCommand:[]},{name:"iso2Epoch",version:"0.0.2",example:"dphelper.date.iso2Epoch(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts an ISO date value to epoch time.",env:"both",subCommand:[]},{name:"localIsoTime",version:"0.0.2",example:"dphelper.date.localIsoTime(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the local ISO time for a given date value.",env:"both",subCommand:[]},{name:"utc",version:"0.0.2",example:"dphelper.date.utc()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current UTC time.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.date.parse(value, '/')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Parses a date value with a specified separator.",env:"both",subCommand:[]},{name:"year",version:"0.0.2",example:"dphelper.date.year()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current year.",env:"both",subCommand:[]},{name:"addDays",version:"0.0.2",example:"dphelper.date.addDays(date, days)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Adds a specified number of days to a date.",env:"both",subCommand:[]},{name:"dateTimeToString",version:"0.0.2",example:"dphelper.date.dateTimeToString(dateObject)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date object to a string.",env:"both",subCommand:[]},{name:"isoToHuman",version:"0.0.2",example:"dphelper.date.isoToHuman(value, '@')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts an ISO date value to a human-readable format with a specified symbol.",env:"both",subCommand:[]},{name:"fullDate",version:"0.0.2",example:"dphelper.date.fullDate()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the full date and time in the format DD-MM-YYYY HH:MM:SS.",env:"both",subCommand:[]},{name:"epoch",version:"0.0.2",example:"dphelper.date.epoch()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current epoch time.",env:"both",subCommand:[]},{name:"diffInDays",version:"0.0.2",example:"dphelper.date.diffInDays(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in days between two dates.",env:"both",subCommand:[]},{name:"diffInWeeks",version:"0.0.2",example:"dphelper.date.diffInWeeks(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in weeks between two dates.",env:"both",subCommand:[]},{name:"diffInMonths",version:"0.0.2",example:"dphelper.date.diffInMonths(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in months between two dates.",env:"both",subCommand:[]},{name:"diffInYears",version:"0.0.2",example:"dphelper.date.diffInYears(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in years between two dates.",env:"both",subCommand:[]},{name:"dateToYMD",version:"0.0.2",example:"dphelper.date.dateToYMD(date)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date to the format YYYY-MM-DD.",env:"both",subCommand:[]},{name:"collection",version:"0.0.2",example:"dphelper.date.collection()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets various date representations based on the type and locale.",env:"both",subCommand:[]},{name:"timeZones",version:"0.0.2",example:"dphelper.date.timeZones()",author:"Dario Passariello",creationDate:"20240901",lastMod:"20260220",type:"function",active:true,description:"Returns an array of all supported timezones.",env:"both",subCommand:[]}]},D={days:(e="en")=>({en:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],it:["luned\xEC","marted\xEC","mercoled\xEC","gioved\xEC","venerd\xEC","sabato","domenica"]})[e],months:(e="en")=>p[e],year:()=>new Date().getFullYear(),toIso:(e,t="en")=>{e||(e="");let a=new Date(e);return String(a)==="Invalid Date"?null:new Intl.DateTimeFormat(t,{year:"numeric",month:"long",day:"numeric"}).format(a)},toMMDDYYYY:e=>{try{let t=new Date(e);return isNaN(t.getTime())?"":`0${t.getMonth()+1}`.slice(-2)+""+`0${t.getDate()}`.slice(-2)+t.getFullYear()}catch{return ""}},toYYYYMMDD:e=>{if(e)return e.toISOString().split("T")[0].replaceAll("-","")},toHuman:e=>{let t={weekday:"long",year:"numeric",month:"long",day:"numeric"};return e.toLocaleDateString(void 0,t)},convert:(e,t)=>{if(!e)return null;t||(t=dphelper.date.months("en"));let a=e.substring(0,2).replace("0",""),o=e.substring(2,4),n=e.substring(e.length-4);return `${o} ${t[Number(a)-1]} ${n}`},iso2Epoch:e=>(e||(e=""),new Date(e).getTime()),localIsoTime:e=>{e||(e=new Date);let t=new Date(e);if(isNaN(t.getTime()))return "";let a=t.getTimezoneOffset()*6e4;return new Date(Date.now()-a).toISOString().slice(0,-1)},utc:()=>new Date().toUTCString(),parse:(e,t="/")=>{if(!e)return null;let a=e.substring(0,2),o=e.substring(2,4),n=e.substring(4,8);return a+t+o+t+n},addDays:(e,t)=>{let a=new Date(Number(e));return a.setDate(e.getDate()+t),a},dateTimeToString:e=>{try{return `${e.getFullYear()}${e.getMonth().toString().length>1?e.getMonth()+1:`0${e.getMonth()+1}`}
2
2
  ${e.getDate().toString().length>1?e.getDate():`0${e.getDate()}`}_${e.getHours()}${e.getMinutes()}${e.getSeconds()}`}catch(t){return console.error(t),e}},isoToHuman:(e,t="@")=>{if(!e)return null;let a=dphelper.date.months("en"),o=new Date(e),n=o.getFullYear(),s=e.split("T")[1].split(":").slice(0,2).join(":"),r=(o.getMonth()+1).toString(),l=o.getDate().toString();return l.length<2&&(l=`0${l}`),r.length<2&&(r=`0${r}`),`${l} ${a[Number(r)-1]} ${n} ${t} ${s}`},fullDate:()=>{let e=new Date,t=Number(e.getDate()),a=Number(e.getMonth()+1),o=Number(e.getFullYear()),n=Number(e.getHours()),s=Number(e.getMinutes()),r=Number(e.getSeconds());return (t<10?`0${t}`:t)+"-"+(a<10?`0${a}`:a)+"-"+o+" "+(n<10?`0${n}`:n)+":"+(s<10?`0${s}`:s)+":"+(r<10?`0${r}`:r)},epoch:()=>Date.now(),diffInDays:(e,t)=>{let a=t.getTime(),o=e.getTime();return Math.floor((a-o)/(24*3600*1e3))},diffInWeeks:(e,t)=>{let a=t.getTime(),o=e.getTime();return Number(Number.parseInt(String((a-o)/(24*3600*1e3*7)),10))},diffInMonths:(e,t)=>{let a=e.getFullYear(),o=t.getFullYear(),n=e.getMonth();return t.getMonth()+12*o-(n+12*a)},diffInYears:(e,t)=>t.getFullYear()-e.getFullYear(),dateToYMD:e=>{let t=e.getDate(),a=e.getMonth()+1;return `${e.getFullYear()}-${a<=9?`0${a}`:a}-${t<=9?`0${t}`:t}`},collection:({date:e=new Date,type:t="",locale:a="en-US"})=>{!e&&t&&a&&console.debug(`
3
3
  "toDateString" -> Tue Jan 02 2024
4
4
  "toISOString" -> 2024-01-02T18:44:43.590Z