dphelper 4.6.1 → 4.6.2

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 (110) hide show
  1. package/README.md +445 -225
  2. package/index.cjs +1 -1
  3. package/index.js +1 -1
  4. package/llms.txt +487 -45
  5. package/modules/ai.cjs +1 -1
  6. package/modules/ai.js +1 -1
  7. package/modules/anchor.cjs +1 -1
  8. package/modules/anchor.js +1 -1
  9. package/modules/array.cjs +1 -1
  10. package/modules/array.js +1 -1
  11. package/modules/audio.cjs +1 -1
  12. package/modules/audio.js +1 -1
  13. package/modules/avoid.cjs +1 -1
  14. package/modules/avoid.js +1 -1
  15. package/modules/biometric.cjs +1 -1
  16. package/modules/biometric.js +1 -1
  17. package/modules/browser.cjs +1 -1
  18. package/modules/browser.js +1 -1
  19. package/modules/check.cjs +1 -1
  20. package/modules/check.js +1 -1
  21. package/modules/color.cjs +1 -1
  22. package/modules/color.js +1 -1
  23. package/modules/compress.cjs +1 -1
  24. package/modules/compress.js +1 -1
  25. package/modules/cookie.cjs +1 -1
  26. package/modules/cookie.js +1 -1
  27. package/modules/coords.cjs +1 -1
  28. package/modules/coords.js +1 -1
  29. package/modules/credits.cjs +1 -1
  30. package/modules/credits.js +1 -1
  31. package/modules/date.cjs +1 -1
  32. package/modules/date.js +1 -1
  33. package/modules/disable.cjs +1 -1
  34. package/modules/disable.js +1 -1
  35. package/modules/dispatch.cjs +1 -1
  36. package/modules/dispatch.js +1 -1
  37. package/modules/elements.cjs +1 -1
  38. package/modules/elements.js +1 -1
  39. package/modules/events.cjs +1 -1
  40. package/modules/events.js +1 -1
  41. package/modules/fetch.cjs +1 -1
  42. package/modules/fetch.js +1 -1
  43. package/modules/form.cjs +1 -1
  44. package/modules/form.js +1 -1
  45. package/modules/format.cjs +1 -1
  46. package/modules/format.js +1 -1
  47. package/modules/i18n.cjs +1 -1
  48. package/modules/i18n.js +1 -1
  49. package/modules/image.cjs +1 -1
  50. package/modules/image.js +1 -1
  51. package/modules/json.cjs +1 -1
  52. package/modules/json.js +1 -1
  53. package/modules/load.cjs +1 -1
  54. package/modules/load.js +1 -1
  55. package/modules/logging.cjs +1 -1
  56. package/modules/logging.js +1 -1
  57. package/modules/math.cjs +1 -1
  58. package/modules/math.js +1 -1
  59. package/modules/memory.cjs +1 -1
  60. package/modules/memory.js +1 -1
  61. package/modules/navigation.cjs +1 -1
  62. package/modules/navigation.js +1 -1
  63. package/modules/net.cjs +1 -1
  64. package/modules/net.js +1 -1
  65. package/modules/objects.cjs +1 -1
  66. package/modules/objects.js +1 -1
  67. package/modules/path.cjs +1 -1
  68. package/modules/path.js +1 -1
  69. package/modules/promise.cjs +1 -1
  70. package/modules/promise.js +1 -1
  71. package/modules/sanitize.cjs +1 -1
  72. package/modules/sanitize.js +1 -1
  73. package/modules/screen.cjs +1 -1
  74. package/modules/screen.js +1 -1
  75. package/modules/scrollbar.cjs +1 -1
  76. package/modules/scrollbar.js +1 -1
  77. package/modules/security.cjs +1 -1
  78. package/modules/security.js +1 -1
  79. package/modules/shortcut.cjs +1 -1
  80. package/modules/shortcut.js +1 -1
  81. package/modules/socket.cjs +1 -1
  82. package/modules/socket.js +1 -1
  83. package/modules/sse.cjs +1 -1
  84. package/modules/sse.js +1 -1
  85. package/modules/svg.cjs +1 -1
  86. package/modules/svg.js +1 -1
  87. package/modules/sync.cjs +1 -1
  88. package/modules/sync.js +1 -1
  89. package/modules/system.cjs +1 -1
  90. package/modules/system.js +1 -1
  91. package/modules/text.cjs +1 -1
  92. package/modules/text.js +1 -1
  93. package/modules/timer.cjs +1 -1
  94. package/modules/timer.js +1 -1
  95. package/modules/tools.cjs +1 -1
  96. package/modules/tools.js +1 -1
  97. package/modules/translators.cjs +1 -1
  98. package/modules/translators.js +1 -1
  99. package/modules/triggers.cjs +1 -1
  100. package/modules/triggers.js +1 -1
  101. package/modules/types.cjs +1 -1
  102. package/modules/types.js +1 -1
  103. package/modules/ui.cjs +1 -1
  104. package/modules/ui.js +1 -1
  105. package/modules/window.cjs +1 -1
  106. package/modules/window.js +1 -1
  107. package/modules/worker.cjs +1 -1
  108. package/modules/worker.js +1 -1
  109. package/package.json +2 -2
  110. package/sbom.json +7 -7
package/modules/form.cjs CHANGED
@@ -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 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:[],...d},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:(t,a,r)=>{Object.defineProperty(t,a.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(t[a.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(t,a)=>{Object.defineProperties(s,{[t.name]:{value:a,writable:false,configurable:false,enumerable:false}}),Object.keys(a).map(r=>(Object.defineProperties(s[t.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,t,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(t);}});var v={email:/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/},y={name:"form",active:true,subCommand:[{name:"serialize",version:"0.0.2",example:"dphelper.form.serialize([form])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Serialize form data into an object.",env:"client",subCommand:[]},{name:"confirmType",version:"0.0.2",example:"dphelper.form.confirmType([type, value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Confirm the type of a value.",env:"client",subCommand:[]},{name:"required",version:"0.0.2",example:"dphelper.form.required([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is required.",env:"client",subCommand:[]},{name:"minLength",version:"0.0.2",example:"dphelper.form.minLength([value, num = 1])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value meets the minimum length.",env:"client",subCommand:[]},{name:"maxLength",version:"0.0.2",example:"dphelper.form.maxLength([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value exceeds the maximum length.",env:"client",subCommand:[]},{name:"maxPhoneNumber",version:"0.0.2",example:"dphelper.form.maxPhoneNumber([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a phone number exceeds the maximum length.",env:"client",subCommand:[]},{name:"isNumeric",version:"0.0.2",example:"dphelper.form.isNumeric([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is numeric.",env:"client",subCommand:[]},{name:"isEmail",version:"0.0.2",example:"dphelper.form.isEmail([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Validate an email format.",env:"client",subCommand:[]},{name:"pattern",version:"0.0.2",example:"dphelper.form.pattern(event)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Pattern validation using onChange on inputs when you provide a pattern.",env:"client",subCommand:[]},{name:"noSpecialChars",version:"0.0.2",example:"dphelper.form.noSpecialChars(event)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Avoid special characters in an input.",env:"client",subCommand:[]},{name:"table",version:"0.0.2",example:"dphelper.form.table(size = [7, 24], id, elem)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:true,description:"Generate a table (default 7x24).",env:"client",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.form.sanitize(input)",author:"Dario Passariello",creationDate:"20240318",lastMod:"20240318",type:"function",active:true,description:"Sanitize input value to avoid injection.",env:"client",subCommand:[]}]},x={serialize:t=>{let a=typeof t=="string"?document.querySelector(t):t;if(!a)return {};let r={};if(!{validate:/^[a-zA-Z][a-zA-Z0-9-_.]{0,199}$/}.validate.test(a.name))return;let m=e=>(e===""&&(e=null),e==="null"&&(e=null),e==="undefined"&&(e=void 0),e==="false"&&(e=false),e==="true"&&(e=true),e==="off"&&(e=false),e==="on"&&(e=true),e==="[]"&&(e=Array),e==="{}"&&(e=Object),["null","undefined","false","true","on","off"].filter(o=>o.includes(e)).length===0&&!Number.isNaN(e)&&(e=Number(e)),e),c=(e,n)=>{let i=[...e],o=i[0];o.slice(-1)==="]"&&(o=o.slice(0,-1));let p={};return i.length===1?p[o]=m(n):(i.shift(),p[o]=c(i,n)),p},l;a instanceof HTMLFormElement?l=Array.from(new FormData(a)).map(([e,n])=>({name:String(e),value:typeof n=="object"&&n!==null?n:JSON.stringify(n)})):typeof a.serializeArray=="function"?l=a.serializeArray():(l=[],a.querySelectorAll("input, select, textarea").forEach(n=>{n.name&&l.push({name:n.name,value:n.value||""});}));for(let e of l){let n=e.value,i=e.name.split("["),o=c(i,n);Object.assign(r,o);}return r},confirmType:(t,a)=>t==="number"?/^\d+$/.test(a.toString()):t==="email"?/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(a.toString().toLowerCase()):true,required:t=>t==null?"Required":void 0,minLength:(t,a=1)=>!t||t.length<a?"Must Enter a Value":void 0,maxLength:(t,a=10)=>t.length>a?"Exceeds Max Length":void 0,maxPhoneNumber:(t,a=10)=>t.toString().length>a?"Exceeds Max Length":void 0,isNumeric:t=>!Number.isNaN(t),isEmail:t=>v.email.test(t.toString().toLowerCase()),pattern:t=>{let a=t.target;if(!(a.type&&a.value))return;let r;switch(a.type){case "text":case "password":r=/^[a-zA-Z0-9.\- !$@]+$/;break;case "email":r=/^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})*$/;break;case "number":r=/^[0-9\-+]*$/;break;case "tel":r=/^[0-9\s()\-+]*$/;break;default:return}a.value.match(r)||(a.value=a.value.slice(0,-1),t.preventDefault());},noSpecialChars:t=>{let a=t.target,r=a.value.trim(),u=/[^\w\s]/gi;r.length>2&&(a.value=r.replace(u,""));},table:(t,a,r)=>{let u=t[0]||7,m=t[1]||24,c=n=>String(n).replace(/[&<>"']/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[i]||i),e=`<form id='${c(a||`table_${Date.now()}`)}'>`;e+="<div class='table'>",e+="<div class='title'>";for(let n=1;n<=u;n++)e+=`<span>${n}</span>`;e+="</div>";for(let n=1;n<=m;n++){e+=`<div class='row'><span>${n}</span>`;for(let i=1;i<=u;i++){let o=c(`${i} to ${n}`);e+=`<input name='data[${i}][${n}]' tabindex='${i.toString().padStart(2,"0")}${n.toString().padStart(2,"0")}' type='number' onclick="this.select()" value='${Math.floor(Math.random()*100)}' title='${o}' />`;}e+="</div>";}e+="</div>",e+="</form>",r&&(r.innerHTML=e);},sanitize:t=>{if(t)return t.replace(/[^\w ]/g,"").replace(/[&/\\#, +()$~%.'":*?<>{}]/g,"")}};dphelper?.setDescription(y,x);var S=dphelper.form;exports.form=S;
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 h={version:"4.6.2"};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: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:(t,a,r)=>{Object.defineProperty(t,a.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(t[a.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(t,a)=>{Object.defineProperties(s,{[t.name]:{value:a,writable:false,configurable:false,enumerable:false}}),Object.keys(a).map(r=>(Object.defineProperties(s[t.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,t,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(t);}});var v={email:/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/},y={name:"form",active:true,subCommand:[{name:"serialize",version:"0.0.2",example:"dphelper.form.serialize([form])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Serialize form data into an object.",env:"client",subCommand:[]},{name:"confirmType",version:"0.0.2",example:"dphelper.form.confirmType([type, value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Confirm the type of a value.",env:"client",subCommand:[]},{name:"required",version:"0.0.2",example:"dphelper.form.required([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is required.",env:"client",subCommand:[]},{name:"minLength",version:"0.0.2",example:"dphelper.form.minLength([value, num = 1])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value meets the minimum length.",env:"client",subCommand:[]},{name:"maxLength",version:"0.0.2",example:"dphelper.form.maxLength([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value exceeds the maximum length.",env:"client",subCommand:[]},{name:"maxPhoneNumber",version:"0.0.2",example:"dphelper.form.maxPhoneNumber([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a phone number exceeds the maximum length.",env:"client",subCommand:[]},{name:"isNumeric",version:"0.0.2",example:"dphelper.form.isNumeric([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is numeric.",env:"client",subCommand:[]},{name:"isEmail",version:"0.0.2",example:"dphelper.form.isEmail([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Validate an email format.",env:"client",subCommand:[]},{name:"pattern",version:"0.0.2",example:"dphelper.form.pattern(event)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Pattern validation using onChange on inputs when you provide a pattern.",env:"client",subCommand:[]},{name:"noSpecialChars",version:"0.0.2",example:"dphelper.form.noSpecialChars(event)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Avoid special characters in an input.",env:"client",subCommand:[]},{name:"table",version:"0.0.2",example:"dphelper.form.table(size = [7, 24], id, elem)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:true,description:"Generate a table (default 7x24).",env:"client",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.form.sanitize(input)",author:"Dario Passariello",creationDate:"20240318",lastMod:"20240318",type:"function",active:true,description:"Sanitize input value to avoid injection.",env:"client",subCommand:[]}]},x={serialize:t=>{let a=typeof t=="string"?document.querySelector(t):t;if(!a)return {};let r={};if(!{validate:/^[a-zA-Z][a-zA-Z0-9-_.]{0,199}$/}.validate.test(a.name))return;let m=e=>(e===""&&(e=null),e==="null"&&(e=null),e==="undefined"&&(e=void 0),e==="false"&&(e=false),e==="true"&&(e=true),e==="off"&&(e=false),e==="on"&&(e=true),e==="[]"&&(e=Array),e==="{}"&&(e=Object),["null","undefined","false","true","on","off"].filter(o=>o.includes(e)).length===0&&!Number.isNaN(e)&&(e=Number(e)),e),c=(e,n)=>{let i=[...e],o=i[0];o.slice(-1)==="]"&&(o=o.slice(0,-1));let p={};return i.length===1?p[o]=m(n):(i.shift(),p[o]=c(i,n)),p},l;a instanceof HTMLFormElement?l=Array.from(new FormData(a)).map(([e,n])=>({name:String(e),value:typeof n=="object"&&n!==null?n:JSON.stringify(n)})):typeof a.serializeArray=="function"?l=a.serializeArray():(l=[],a.querySelectorAll("input, select, textarea").forEach(n=>{n.name&&l.push({name:n.name,value:n.value||""});}));for(let e of l){let n=e.value,i=e.name.split("["),o=c(i,n);Object.assign(r,o);}return r},confirmType:(t,a)=>t==="number"?/^\d+$/.test(a.toString()):t==="email"?/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(a.toString().toLowerCase()):true,required:t=>t==null?"Required":void 0,minLength:(t,a=1)=>!t||t.length<a?"Must Enter a Value":void 0,maxLength:(t,a=10)=>t.length>a?"Exceeds Max Length":void 0,maxPhoneNumber:(t,a=10)=>t.toString().length>a?"Exceeds Max Length":void 0,isNumeric:t=>!Number.isNaN(t),isEmail:t=>v.email.test(t.toString().toLowerCase()),pattern:t=>{let a=t.target;if(!(a.type&&a.value))return;let r;switch(a.type){case "text":case "password":r=/^[a-zA-Z0-9.\- !$@]+$/;break;case "email":r=/^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})*$/;break;case "number":r=/^[0-9\-+]*$/;break;case "tel":r=/^[0-9\s()\-+]*$/;break;default:return}a.value.match(r)||(a.value=a.value.slice(0,-1),t.preventDefault());},noSpecialChars:t=>{let a=t.target,r=a.value.trim(),u=/[^\w\s]/gi;r.length>2&&(a.value=r.replace(u,""));},table:(t,a,r)=>{let u=t[0]||7,m=t[1]||24,c=n=>String(n).replace(/[&<>"']/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[i]||i),e=`<form id='${c(a||`table_${Date.now()}`)}'>`;e+="<div class='table'>",e+="<div class='title'>";for(let n=1;n<=u;n++)e+=`<span>${n}</span>`;e+="</div>";for(let n=1;n<=m;n++){e+=`<div class='row'><span>${n}</span>`;for(let i=1;i<=u;i++){let o=c(`${i} to ${n}`);e+=`<input name='data[${i}][${n}]' tabindex='${i.toString().padStart(2,"0")}${n.toString().padStart(2,"0")}' type='number' onclick="this.select()" value='${Math.floor(Math.random()*100)}' title='${o}' />`;}e+="</div>";}e+="</div>",e+="</form>",r&&(r.innerHTML=e);},sanitize:t=>{if(t)return t.replace(/[^\w ]/g,"").replace(/[&/\\#, +()$~%.'":*?<>{}]/g,"")}};dphelper?.setDescription(y,x);var S=dphelper.form;exports.form=S;
package/modules/form.js CHANGED
@@ -1 +1 @@
1
- var h={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:[],...h},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 s=dphelper;Object.defineProperty(s,"setProps",{value:(t,a,r)=>{Object.defineProperty(t,a.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(t[a.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(t,a)=>{Object.defineProperties(s,{[t.name]:{value:a,writable:false,configurable:false,enumerable:false}}),Object.keys(a).map(r=>(Object.defineProperties(s[t.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,t,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(t);}});var y={email:/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/},x={name:"form",active:true,subCommand:[{name:"serialize",version:"0.0.2",example:"dphelper.form.serialize([form])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Serialize form data into an object.",env:"client",subCommand:[]},{name:"confirmType",version:"0.0.2",example:"dphelper.form.confirmType([type, value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Confirm the type of a value.",env:"client",subCommand:[]},{name:"required",version:"0.0.2",example:"dphelper.form.required([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is required.",env:"client",subCommand:[]},{name:"minLength",version:"0.0.2",example:"dphelper.form.minLength([value, num = 1])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value meets the minimum length.",env:"client",subCommand:[]},{name:"maxLength",version:"0.0.2",example:"dphelper.form.maxLength([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value exceeds the maximum length.",env:"client",subCommand:[]},{name:"maxPhoneNumber",version:"0.0.2",example:"dphelper.form.maxPhoneNumber([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a phone number exceeds the maximum length.",env:"client",subCommand:[]},{name:"isNumeric",version:"0.0.2",example:"dphelper.form.isNumeric([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is numeric.",env:"client",subCommand:[]},{name:"isEmail",version:"0.0.2",example:"dphelper.form.isEmail([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Validate an email format.",env:"client",subCommand:[]},{name:"pattern",version:"0.0.2",example:"dphelper.form.pattern(event)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Pattern validation using onChange on inputs when you provide a pattern.",env:"client",subCommand:[]},{name:"noSpecialChars",version:"0.0.2",example:"dphelper.form.noSpecialChars(event)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Avoid special characters in an input.",env:"client",subCommand:[]},{name:"table",version:"0.0.2",example:"dphelper.form.table(size = [7, 24], id, elem)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:true,description:"Generate a table (default 7x24).",env:"client",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.form.sanitize(input)",author:"Dario Passariello",creationDate:"20240318",lastMod:"20240318",type:"function",active:true,description:"Sanitize input value to avoid injection.",env:"client",subCommand:[]}]},w={serialize:t=>{let a=typeof t=="string"?document.querySelector(t):t;if(!a)return {};let r={};if(!{validate:/^[a-zA-Z][a-zA-Z0-9-_.]{0,199}$/}.validate.test(a.name))return;let m=e=>(e===""&&(e=null),e==="null"&&(e=null),e==="undefined"&&(e=void 0),e==="false"&&(e=false),e==="true"&&(e=true),e==="off"&&(e=false),e==="on"&&(e=true),e==="[]"&&(e=Array),e==="{}"&&(e=Object),["null","undefined","false","true","on","off"].filter(o=>o.includes(e)).length===0&&!Number.isNaN(e)&&(e=Number(e)),e),c=(e,n)=>{let i=[...e],o=i[0];o.slice(-1)==="]"&&(o=o.slice(0,-1));let p={};return i.length===1?p[o]=m(n):(i.shift(),p[o]=c(i,n)),p},l;a instanceof HTMLFormElement?l=Array.from(new FormData(a)).map(([e,n])=>({name:String(e),value:typeof n=="object"&&n!==null?n:JSON.stringify(n)})):typeof a.serializeArray=="function"?l=a.serializeArray():(l=[],a.querySelectorAll("input, select, textarea").forEach(n=>{n.name&&l.push({name:n.name,value:n.value||""});}));for(let e of l){let n=e.value,i=e.name.split("["),o=c(i,n);Object.assign(r,o);}return r},confirmType:(t,a)=>t==="number"?/^\d+$/.test(a.toString()):t==="email"?/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(a.toString().toLowerCase()):true,required:t=>t==null?"Required":void 0,minLength:(t,a=1)=>!t||t.length<a?"Must Enter a Value":void 0,maxLength:(t,a=10)=>t.length>a?"Exceeds Max Length":void 0,maxPhoneNumber:(t,a=10)=>t.toString().length>a?"Exceeds Max Length":void 0,isNumeric:t=>!Number.isNaN(t),isEmail:t=>y.email.test(t.toString().toLowerCase()),pattern:t=>{let a=t.target;if(!(a.type&&a.value))return;let r;switch(a.type){case "text":case "password":r=/^[a-zA-Z0-9.\- !$@]+$/;break;case "email":r=/^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})*$/;break;case "number":r=/^[0-9\-+]*$/;break;case "tel":r=/^[0-9\s()\-+]*$/;break;default:return}a.value.match(r)||(a.value=a.value.slice(0,-1),t.preventDefault());},noSpecialChars:t=>{let a=t.target,r=a.value.trim(),u=/[^\w\s]/gi;r.length>2&&(a.value=r.replace(u,""));},table:(t,a,r)=>{let u=t[0]||7,m=t[1]||24,c=n=>String(n).replace(/[&<>"']/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[i]||i),e=`<form id='${c(a||`table_${Date.now()}`)}'>`;e+="<div class='table'>",e+="<div class='title'>";for(let n=1;n<=u;n++)e+=`<span>${n}</span>`;e+="</div>";for(let n=1;n<=m;n++){e+=`<div class='row'><span>${n}</span>`;for(let i=1;i<=u;i++){let o=c(`${i} to ${n}`);e+=`<input name='data[${i}][${n}]' tabindex='${i.toString().padStart(2,"0")}${n.toString().padStart(2,"0")}' type='number' onclick="this.select()" value='${Math.floor(Math.random()*100)}' title='${o}' />`;}e+="</div>";}e+="</div>",e+="</form>",r&&(r.innerHTML=e);},sanitize:t=>{if(t)return t.replace(/[^\w ]/g,"").replace(/[&/\\#, +()$~%.'":*?<>{}]/g,"")}};dphelper?.setDescription(x,w);var E=dphelper.form;export{E as form};
1
+ var h={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.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...h},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 s=dphelper;Object.defineProperty(s,"setProps",{value:(t,a,r)=>{Object.defineProperty(t,a.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(t[a.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(t,a)=>{Object.defineProperties(s,{[t.name]:{value:a,writable:false,configurable:false,enumerable:false}}),Object.keys(a).map(r=>(Object.defineProperties(s[t.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,t,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(t);}});var y={email:/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/},x={name:"form",active:true,subCommand:[{name:"serialize",version:"0.0.2",example:"dphelper.form.serialize([form])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Serialize form data into an object.",env:"client",subCommand:[]},{name:"confirmType",version:"0.0.2",example:"dphelper.form.confirmType([type, value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Confirm the type of a value.",env:"client",subCommand:[]},{name:"required",version:"0.0.2",example:"dphelper.form.required([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is required.",env:"client",subCommand:[]},{name:"minLength",version:"0.0.2",example:"dphelper.form.minLength([value, num = 1])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value meets the minimum length.",env:"client",subCommand:[]},{name:"maxLength",version:"0.0.2",example:"dphelper.form.maxLength([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value exceeds the maximum length.",env:"client",subCommand:[]},{name:"maxPhoneNumber",version:"0.0.2",example:"dphelper.form.maxPhoneNumber([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a phone number exceeds the maximum length.",env:"client",subCommand:[]},{name:"isNumeric",version:"0.0.2",example:"dphelper.form.isNumeric([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is numeric.",env:"client",subCommand:[]},{name:"isEmail",version:"0.0.2",example:"dphelper.form.isEmail([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Validate an email format.",env:"client",subCommand:[]},{name:"pattern",version:"0.0.2",example:"dphelper.form.pattern(event)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Pattern validation using onChange on inputs when you provide a pattern.",env:"client",subCommand:[]},{name:"noSpecialChars",version:"0.0.2",example:"dphelper.form.noSpecialChars(event)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Avoid special characters in an input.",env:"client",subCommand:[]},{name:"table",version:"0.0.2",example:"dphelper.form.table(size = [7, 24], id, elem)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:true,description:"Generate a table (default 7x24).",env:"client",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.form.sanitize(input)",author:"Dario Passariello",creationDate:"20240318",lastMod:"20240318",type:"function",active:true,description:"Sanitize input value to avoid injection.",env:"client",subCommand:[]}]},w={serialize:t=>{let a=typeof t=="string"?document.querySelector(t):t;if(!a)return {};let r={};if(!{validate:/^[a-zA-Z][a-zA-Z0-9-_.]{0,199}$/}.validate.test(a.name))return;let m=e=>(e===""&&(e=null),e==="null"&&(e=null),e==="undefined"&&(e=void 0),e==="false"&&(e=false),e==="true"&&(e=true),e==="off"&&(e=false),e==="on"&&(e=true),e==="[]"&&(e=Array),e==="{}"&&(e=Object),["null","undefined","false","true","on","off"].filter(o=>o.includes(e)).length===0&&!Number.isNaN(e)&&(e=Number(e)),e),c=(e,n)=>{let i=[...e],o=i[0];o.slice(-1)==="]"&&(o=o.slice(0,-1));let p={};return i.length===1?p[o]=m(n):(i.shift(),p[o]=c(i,n)),p},l;a instanceof HTMLFormElement?l=Array.from(new FormData(a)).map(([e,n])=>({name:String(e),value:typeof n=="object"&&n!==null?n:JSON.stringify(n)})):typeof a.serializeArray=="function"?l=a.serializeArray():(l=[],a.querySelectorAll("input, select, textarea").forEach(n=>{n.name&&l.push({name:n.name,value:n.value||""});}));for(let e of l){let n=e.value,i=e.name.split("["),o=c(i,n);Object.assign(r,o);}return r},confirmType:(t,a)=>t==="number"?/^\d+$/.test(a.toString()):t==="email"?/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(a.toString().toLowerCase()):true,required:t=>t==null?"Required":void 0,minLength:(t,a=1)=>!t||t.length<a?"Must Enter a Value":void 0,maxLength:(t,a=10)=>t.length>a?"Exceeds Max Length":void 0,maxPhoneNumber:(t,a=10)=>t.toString().length>a?"Exceeds Max Length":void 0,isNumeric:t=>!Number.isNaN(t),isEmail:t=>y.email.test(t.toString().toLowerCase()),pattern:t=>{let a=t.target;if(!(a.type&&a.value))return;let r;switch(a.type){case "text":case "password":r=/^[a-zA-Z0-9.\- !$@]+$/;break;case "email":r=/^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})*$/;break;case "number":r=/^[0-9\-+]*$/;break;case "tel":r=/^[0-9\s()\-+]*$/;break;default:return}a.value.match(r)||(a.value=a.value.slice(0,-1),t.preventDefault());},noSpecialChars:t=>{let a=t.target,r=a.value.trim(),u=/[^\w\s]/gi;r.length>2&&(a.value=r.replace(u,""));},table:(t,a,r)=>{let u=t[0]||7,m=t[1]||24,c=n=>String(n).replace(/[&<>"']/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[i]||i),e=`<form id='${c(a||`table_${Date.now()}`)}'>`;e+="<div class='table'>",e+="<div class='title'>";for(let n=1;n<=u;n++)e+=`<span>${n}</span>`;e+="</div>";for(let n=1;n<=m;n++){e+=`<div class='row'><span>${n}</span>`;for(let i=1;i<=u;i++){let o=c(`${i} to ${n}`);e+=`<input name='data[${i}][${n}]' tabindex='${i.toString().padStart(2,"0")}${n.toString().padStart(2,"0")}' type='number' onclick="this.select()" value='${Math.floor(Math.random()*100)}' title='${o}' />`;}e+="</div>";}e+="</div>",e+="</form>",r&&(r.innerHTML=e);},sanitize:t=>{if(t)return t.replace(/[^\w ]/g,"").replace(/[&/\\#, +()$~%.'":*?<>{}]/g,"")}};dphelper?.setDescription(x,w);var E=dphelper.form;export{E as form};
@@ -1 +1 @@
1
- 'use strict';var n={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var s={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...n},configurable:true,writable:true},version:{value:s.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:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(e,t)=>{Object.defineProperties(a,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(a[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,e,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(e);}});var p={name:"format",active:true,subCommand:[{name:"currency",version:"0.0.2",example:"dphelper.format.currency(value, locale, currency)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a number as currency.",env:"both",subCommand:[]},{name:"phoneNumber",version:"0.0.2",example:"dphelper.format.phoneNumber(value, countryCode)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a string as a phone number.",env:"both",subCommand:[]}]},u={currency:(e,t="en-US",r="USD")=>new Intl.NumberFormat(t,{style:"currency",currency:r}).format(e),phoneNumber:(e,t="US")=>{let r=`${e}`.replace(/\D/g,""),o;return t==="US"&&(o=r.match(/^(\d{3})(\d{3})(\d{4})$/),o)?`(${o[1]}) ${o[2]}-${o[3]}`:e}};typeof dphelper?.setDescription=="function"&&dphelper.setDescription(p,u);var D=dphelper.format;exports.format=D;
1
+ 'use strict';var n={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var s={version:"4.6.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...n},configurable:true,writable:true},version:{value:s.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:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(e,t)=>{Object.defineProperties(a,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(a[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,e,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(e);}});var p={name:"format",active:true,subCommand:[{name:"currency",version:"0.0.2",example:"dphelper.format.currency(value, locale, currency)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a number as currency.",env:"both",subCommand:[]},{name:"phoneNumber",version:"0.0.2",example:"dphelper.format.phoneNumber(value, countryCode)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a string as a phone number.",env:"both",subCommand:[]}]},u={currency:(e,t="en-US",r="USD")=>new Intl.NumberFormat(t,{style:"currency",currency:r}).format(e),phoneNumber:(e,t="US")=>{let r=`${e}`.replace(/\D/g,""),o;return t==="US"&&(o=r.match(/^(\d{3})(\d{3})(\d{4})$/),o)?`(${o[1]}) ${o[2]}-${o[3]}`:e}};typeof dphelper?.setDescription=="function"&&dphelper.setDescription(p,u);var D=dphelper.format;exports.format=D;
package/modules/format.js CHANGED
@@ -1 +1 @@
1
- var s={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var i={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:i.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:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(e,t)=>{Object.defineProperties(a,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(a[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,e,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(e);}});var u={name:"format",active:true,subCommand:[{name:"currency",version:"0.0.2",example:"dphelper.format.currency(value, locale, currency)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a number as currency.",env:"both",subCommand:[]},{name:"phoneNumber",version:"0.0.2",example:"dphelper.format.phoneNumber(value, countryCode)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a string as a phone number.",env:"both",subCommand:[]}]},b={currency:(e,t="en-US",r="USD")=>new Intl.NumberFormat(t,{style:"currency",currency:r}).format(e),phoneNumber:(e,t="US")=>{let r=`${e}`.replace(/\D/g,""),o;return t==="US"&&(o=r.match(/^(\d{3})(\d{3})(\d{4})$/),o)?`(${o[1]}) ${o[2]}-${o[3]}`:e}};typeof dphelper?.setDescription=="function"&&dphelper.setDescription(u,b);var O=dphelper.format;export{O as format};
1
+ var s={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var i={version:"4.6.2"};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:i.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:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(e,t)=>{Object.defineProperties(a,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(a[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,e,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(e);}});var u={name:"format",active:true,subCommand:[{name:"currency",version:"0.0.2",example:"dphelper.format.currency(value, locale, currency)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a number as currency.",env:"both",subCommand:[]},{name:"phoneNumber",version:"0.0.2",example:"dphelper.format.phoneNumber(value, countryCode)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a string as a phone number.",env:"both",subCommand:[]}]},b={currency:(e,t="en-US",r="USD")=>new Intl.NumberFormat(t,{style:"currency",currency:r}).format(e),phoneNumber:(e,t="US")=>{let r=`${e}`.replace(/\D/g,""),o;return t==="US"&&(o=r.match(/^(\d{3})(\d{3})(\d{4})$/),o)?`(${o[1]}) ${o[2]}-${o[3]}`:e}};typeof dphelper?.setDescription=="function"&&dphelper.setDescription(u,b);var O=dphelper.format;export{O as format};
package/modules/i18n.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var g={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var v={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...g},configurable:true,writable:true},version:{value:v.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,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.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(r=>(Object.defineProperties(i[e.name],{[r]:{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:"i18n",active:true,subCommand:[{name:"setLocale",version:"0.0.1",example:"dphelper.i18n.setLocale('it')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Set the current locale",env:"both",subCommand:[]},{name:"t",version:"0.0.1",example:"dphelper.i18n.t('hello', { name: 'World' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Translate a key with optional interpolation",env:"both",subCommand:[]},{name:"addTranslations",version:"0.0.1",example:"dphelper.i18n.addTranslations('it', { hello: 'Ciao {name}!' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Add translation strings for a locale",env:"both",subCommand:[]},{name:"getLocale",version:"0.0.1",example:"dphelper.i18n.getLocale()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get the current locale",env:"both",subCommand:[]},{name:"pluralize",version:"0.0.1",example:"dphelper.i18n.pluralize(5, { one: 'item', other: 'items' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get pluralized string based on count",env:"both",subCommand:[]},{name:"number",version:"0.0.1",example:"dphelper.i18n.number(1234.56, 'de-DE', { style: 'currency', currency: 'EUR' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a number according to locale",env:"both",subCommand:[]},{name:"date",version:"0.0.1",example:"dphelper.i18n.date(new Date(), 'en-US', { dateStyle: 'long' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a date according to locale",env:"both",subCommand:[]},{name:"relativeTime",version:"0.0.1",example:"dphelper.i18n.relativeTime(Date.now() - 3600000)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get relative time string (e.g., '2 hours ago')",env:"both",subCommand:[]},{name:"list",version:"0.0.1",example:"dphelper.i18n.list(['a', 'b', 'c'], 'en')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a list according to locale",env:"both",subCommand:[]},{name:"getSupportedLocales",version:"0.0.1",example:"dphelper.i18n.getSupportedLocales()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get list of supported locales",env:"both",subCommand:[]}]},s=new Map,a="en";s.set("en",{hello:"Hello {name}!",goodbye:"Goodbye!",welcome:"Welcome to our app!",loading:"Loading...",error:"An error occurred",success:"Success!",confirm:"Are you sure?",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",close:"Close"});var P=e=>{a=e,e==="auto"&&typeof navigator<"u"&&(a=navigator.language.split("-")[0]||"en");},x=()=>a,j=(e,t)=>{let r=s.get(e)||{};s.set(e,{...r,...t});},C=(e,t={})=>{let o=(s.get(a)||s.get("en")||{})[e]||e;return Object.entries(t).forEach(([l,u])=>{o=o.replace(new RegExp(`\\{${l}\\}`,"g"),String(u));}),o},L=(e,t,r)=>{let o=r||a;if(e===0&&t.zero)return t.zero;if(e===1)return t.one||t.other||"";if(e===2&&t.two)return t.two;if(o==="pl"&&e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||"";if(o==="ru"||o==="uk"){if(e%10===1&&e%100!==11)return t.one||t.other||"";if(e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||""}return t.other||String(e)},O=(e,t,r)=>{let o=t||a;return new Intl.NumberFormat(o,r).format(e)},S=(e,t,r)=>{let o=t||a,l=typeof e=="number"?new Date(e):e;return new Intl.DateTimeFormat(o,r).format(l)},T=(e,t)=>{let r=t||a,o=Date.now(),l=typeof e=="number"?e:e.getTime(),u=o-l,n=new Intl.RelativeTimeFormat(r,{numeric:"auto"}),p=Math.floor(u/1e3),m=Math.floor(p/60),d=Math.floor(m/60),c=Math.floor(d/24),h=Math.floor(c/7),b=Math.floor(c/30),w=Math.floor(c/365);return Math.abs(p)<60?n.format(-p,"second"):Math.abs(m)<60?n.format(-m,"minute"):Math.abs(d)<24?n.format(-d,"hour"):Math.abs(c)<7?n.format(-c,"day"):Math.abs(h)<4?n.format(-h,"week"):Math.abs(b)<12?n.format(-b,"month"):n.format(-w,"year")},k=(e,t,r)=>{let o=t||a;return new Intl.ListFormat(o,r).format(e)},F=()=>Array.from(s.keys()),z={setLocale:P,getLocale:x,addTranslations:j,t:C,pluralize:L,number:O,date:S,relativeTime:T,list:k,getSupportedLocales:F};dphelper?.setDescription(M,z);var H=dphelper.i18n;exports.i18n=H;
1
+ 'use strict';var g={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var v={version:"4.6.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...g},configurable:true,writable:true},version:{value:v.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,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.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(r=>(Object.defineProperties(i[e.name],{[r]:{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:"i18n",active:true,subCommand:[{name:"setLocale",version:"0.0.1",example:"dphelper.i18n.setLocale('it')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Set the current locale",env:"both",subCommand:[]},{name:"t",version:"0.0.1",example:"dphelper.i18n.t('hello', { name: 'World' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Translate a key with optional interpolation",env:"both",subCommand:[]},{name:"addTranslations",version:"0.0.1",example:"dphelper.i18n.addTranslations('it', { hello: 'Ciao {name}!' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Add translation strings for a locale",env:"both",subCommand:[]},{name:"getLocale",version:"0.0.1",example:"dphelper.i18n.getLocale()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get the current locale",env:"both",subCommand:[]},{name:"pluralize",version:"0.0.1",example:"dphelper.i18n.pluralize(5, { one: 'item', other: 'items' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get pluralized string based on count",env:"both",subCommand:[]},{name:"number",version:"0.0.1",example:"dphelper.i18n.number(1234.56, 'de-DE', { style: 'currency', currency: 'EUR' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a number according to locale",env:"both",subCommand:[]},{name:"date",version:"0.0.1",example:"dphelper.i18n.date(new Date(), 'en-US', { dateStyle: 'long' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a date according to locale",env:"both",subCommand:[]},{name:"relativeTime",version:"0.0.1",example:"dphelper.i18n.relativeTime(Date.now() - 3600000)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get relative time string (e.g., '2 hours ago')",env:"both",subCommand:[]},{name:"list",version:"0.0.1",example:"dphelper.i18n.list(['a', 'b', 'c'], 'en')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a list according to locale",env:"both",subCommand:[]},{name:"getSupportedLocales",version:"0.0.1",example:"dphelper.i18n.getSupportedLocales()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get list of supported locales",env:"both",subCommand:[]}]},s=new Map,a="en";s.set("en",{hello:"Hello {name}!",goodbye:"Goodbye!",welcome:"Welcome to our app!",loading:"Loading...",error:"An error occurred",success:"Success!",confirm:"Are you sure?",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",close:"Close"});var P=e=>{a=e,e==="auto"&&typeof navigator<"u"&&(a=navigator.language.split("-")[0]||"en");},x=()=>a,j=(e,t)=>{let r=s.get(e)||{};s.set(e,{...r,...t});},C=(e,t={})=>{let o=(s.get(a)||s.get("en")||{})[e]||e;return Object.entries(t).forEach(([l,u])=>{o=o.replace(new RegExp(`\\{${l}\\}`,"g"),String(u));}),o},L=(e,t,r)=>{let o=r||a;if(e===0&&t.zero)return t.zero;if(e===1)return t.one||t.other||"";if(e===2&&t.two)return t.two;if(o==="pl"&&e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||"";if(o==="ru"||o==="uk"){if(e%10===1&&e%100!==11)return t.one||t.other||"";if(e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||""}return t.other||String(e)},O=(e,t,r)=>{let o=t||a;return new Intl.NumberFormat(o,r).format(e)},S=(e,t,r)=>{let o=t||a,l=typeof e=="number"?new Date(e):e;return new Intl.DateTimeFormat(o,r).format(l)},T=(e,t)=>{let r=t||a,o=Date.now(),l=typeof e=="number"?e:e.getTime(),u=o-l,n=new Intl.RelativeTimeFormat(r,{numeric:"auto"}),p=Math.floor(u/1e3),m=Math.floor(p/60),d=Math.floor(m/60),c=Math.floor(d/24),h=Math.floor(c/7),b=Math.floor(c/30),w=Math.floor(c/365);return Math.abs(p)<60?n.format(-p,"second"):Math.abs(m)<60?n.format(-m,"minute"):Math.abs(d)<24?n.format(-d,"hour"):Math.abs(c)<7?n.format(-c,"day"):Math.abs(h)<4?n.format(-h,"week"):Math.abs(b)<12?n.format(-b,"month"):n.format(-w,"year")},k=(e,t,r)=>{let o=t||a;return new Intl.ListFormat(o,r).format(e)},F=()=>Array.from(s.keys()),z={setLocale:P,getLocale:x,addTranslations:j,t:C,pluralize:L,number:O,date:S,relativeTime:T,list:k,getSupportedLocales:F};dphelper?.setDescription(M,z);var H=dphelper.i18n;exports.i18n=H;
package/modules/i18n.js CHANGED
@@ -1 +1 @@
1
- var v={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var w={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...v},configurable:true,writable:true},version:{value:w.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,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.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(r=>(Object.defineProperties(i[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var P={name:"i18n",active:true,subCommand:[{name:"setLocale",version:"0.0.1",example:"dphelper.i18n.setLocale('it')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Set the current locale",env:"both",subCommand:[]},{name:"t",version:"0.0.1",example:"dphelper.i18n.t('hello', { name: 'World' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Translate a key with optional interpolation",env:"both",subCommand:[]},{name:"addTranslations",version:"0.0.1",example:"dphelper.i18n.addTranslations('it', { hello: 'Ciao {name}!' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Add translation strings for a locale",env:"both",subCommand:[]},{name:"getLocale",version:"0.0.1",example:"dphelper.i18n.getLocale()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get the current locale",env:"both",subCommand:[]},{name:"pluralize",version:"0.0.1",example:"dphelper.i18n.pluralize(5, { one: 'item', other: 'items' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get pluralized string based on count",env:"both",subCommand:[]},{name:"number",version:"0.0.1",example:"dphelper.i18n.number(1234.56, 'de-DE', { style: 'currency', currency: 'EUR' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a number according to locale",env:"both",subCommand:[]},{name:"date",version:"0.0.1",example:"dphelper.i18n.date(new Date(), 'en-US', { dateStyle: 'long' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a date according to locale",env:"both",subCommand:[]},{name:"relativeTime",version:"0.0.1",example:"dphelper.i18n.relativeTime(Date.now() - 3600000)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get relative time string (e.g., '2 hours ago')",env:"both",subCommand:[]},{name:"list",version:"0.0.1",example:"dphelper.i18n.list(['a', 'b', 'c'], 'en')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a list according to locale",env:"both",subCommand:[]},{name:"getSupportedLocales",version:"0.0.1",example:"dphelper.i18n.getSupportedLocales()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get list of supported locales",env:"both",subCommand:[]}]},s=new Map,a="en";s.set("en",{hello:"Hello {name}!",goodbye:"Goodbye!",welcome:"Welcome to our app!",loading:"Loading...",error:"An error occurred",success:"Success!",confirm:"Are you sure?",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",close:"Close"});var x=e=>{a=e,e==="auto"&&typeof navigator<"u"&&(a=navigator.language.split("-")[0]||"en");},j=()=>a,C=(e,t)=>{let r=s.get(e)||{};s.set(e,{...r,...t});},L=(e,t={})=>{let o=(s.get(a)||s.get("en")||{})[e]||e;return Object.entries(t).forEach(([l,u])=>{o=o.replace(new RegExp(`\\{${l}\\}`,"g"),String(u));}),o},O=(e,t,r)=>{let o=r||a;if(e===0&&t.zero)return t.zero;if(e===1)return t.one||t.other||"";if(e===2&&t.two)return t.two;if(o==="pl"&&e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||"";if(o==="ru"||o==="uk"){if(e%10===1&&e%100!==11)return t.one||t.other||"";if(e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||""}return t.other||String(e)},S=(e,t,r)=>{let o=t||a;return new Intl.NumberFormat(o,r).format(e)},T=(e,t,r)=>{let o=t||a,l=typeof e=="number"?new Date(e):e;return new Intl.DateTimeFormat(o,r).format(l)},k=(e,t)=>{let r=t||a,o=Date.now(),l=typeof e=="number"?e:e.getTime(),u=o-l,n=new Intl.RelativeTimeFormat(r,{numeric:"auto"}),p=Math.floor(u/1e3),m=Math.floor(p/60),d=Math.floor(m/60),c=Math.floor(d/24),b=Math.floor(c/7),g=Math.floor(c/30),y=Math.floor(c/365);return Math.abs(p)<60?n.format(-p,"second"):Math.abs(m)<60?n.format(-m,"minute"):Math.abs(d)<24?n.format(-d,"hour"):Math.abs(c)<7?n.format(-c,"day"):Math.abs(b)<4?n.format(-b,"week"):Math.abs(g)<12?n.format(-g,"month"):n.format(-y,"year")},F=(e,t,r)=>{let o=t||a;return new Intl.ListFormat(o,r).format(e)},z=()=>Array.from(s.keys()),I={setLocale:x,getLocale:j,addTranslations:C,t:L,pluralize:O,number:S,date:T,relativeTime:k,list:F,getSupportedLocales:z};dphelper?.setDescription(P,I);var $=dphelper.i18n;export{$ as i18n};
1
+ var v={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var w={version:"4.6.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...v},configurable:true,writable:true},version:{value:w.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,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.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(r=>(Object.defineProperties(i[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var P={name:"i18n",active:true,subCommand:[{name:"setLocale",version:"0.0.1",example:"dphelper.i18n.setLocale('it')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Set the current locale",env:"both",subCommand:[]},{name:"t",version:"0.0.1",example:"dphelper.i18n.t('hello', { name: 'World' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Translate a key with optional interpolation",env:"both",subCommand:[]},{name:"addTranslations",version:"0.0.1",example:"dphelper.i18n.addTranslations('it', { hello: 'Ciao {name}!' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Add translation strings for a locale",env:"both",subCommand:[]},{name:"getLocale",version:"0.0.1",example:"dphelper.i18n.getLocale()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get the current locale",env:"both",subCommand:[]},{name:"pluralize",version:"0.0.1",example:"dphelper.i18n.pluralize(5, { one: 'item', other: 'items' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get pluralized string based on count",env:"both",subCommand:[]},{name:"number",version:"0.0.1",example:"dphelper.i18n.number(1234.56, 'de-DE', { style: 'currency', currency: 'EUR' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a number according to locale",env:"both",subCommand:[]},{name:"date",version:"0.0.1",example:"dphelper.i18n.date(new Date(), 'en-US', { dateStyle: 'long' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a date according to locale",env:"both",subCommand:[]},{name:"relativeTime",version:"0.0.1",example:"dphelper.i18n.relativeTime(Date.now() - 3600000)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get relative time string (e.g., '2 hours ago')",env:"both",subCommand:[]},{name:"list",version:"0.0.1",example:"dphelper.i18n.list(['a', 'b', 'c'], 'en')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a list according to locale",env:"both",subCommand:[]},{name:"getSupportedLocales",version:"0.0.1",example:"dphelper.i18n.getSupportedLocales()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get list of supported locales",env:"both",subCommand:[]}]},s=new Map,a="en";s.set("en",{hello:"Hello {name}!",goodbye:"Goodbye!",welcome:"Welcome to our app!",loading:"Loading...",error:"An error occurred",success:"Success!",confirm:"Are you sure?",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",close:"Close"});var x=e=>{a=e,e==="auto"&&typeof navigator<"u"&&(a=navigator.language.split("-")[0]||"en");},j=()=>a,C=(e,t)=>{let r=s.get(e)||{};s.set(e,{...r,...t});},L=(e,t={})=>{let o=(s.get(a)||s.get("en")||{})[e]||e;return Object.entries(t).forEach(([l,u])=>{o=o.replace(new RegExp(`\\{${l}\\}`,"g"),String(u));}),o},O=(e,t,r)=>{let o=r||a;if(e===0&&t.zero)return t.zero;if(e===1)return t.one||t.other||"";if(e===2&&t.two)return t.two;if(o==="pl"&&e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||"";if(o==="ru"||o==="uk"){if(e%10===1&&e%100!==11)return t.one||t.other||"";if(e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||""}return t.other||String(e)},S=(e,t,r)=>{let o=t||a;return new Intl.NumberFormat(o,r).format(e)},T=(e,t,r)=>{let o=t||a,l=typeof e=="number"?new Date(e):e;return new Intl.DateTimeFormat(o,r).format(l)},k=(e,t)=>{let r=t||a,o=Date.now(),l=typeof e=="number"?e:e.getTime(),u=o-l,n=new Intl.RelativeTimeFormat(r,{numeric:"auto"}),p=Math.floor(u/1e3),m=Math.floor(p/60),d=Math.floor(m/60),c=Math.floor(d/24),b=Math.floor(c/7),g=Math.floor(c/30),y=Math.floor(c/365);return Math.abs(p)<60?n.format(-p,"second"):Math.abs(m)<60?n.format(-m,"minute"):Math.abs(d)<24?n.format(-d,"hour"):Math.abs(c)<7?n.format(-c,"day"):Math.abs(b)<4?n.format(-b,"week"):Math.abs(g)<12?n.format(-g,"month"):n.format(-y,"year")},F=(e,t,r)=>{let o=t||a;return new Intl.ListFormat(o,r).format(e)},z=()=>Array.from(s.keys()),I={setLocale:x,getLocale:j,addTranslations:C,t:L,pluralize:O,number:S,date:T,relativeTime:k,list:F,getSupportedLocales:z};dphelper?.setDescription(P,I);var $=dphelper.i18n;export{$ as i18n};
package/modules/image.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var h={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:[],...h},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 s=dphelper;Object.defineProperty(s,"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(s,"setDescription",{value:(e,t)=>{Object.defineProperties(s,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(s[e.name],{[a]:{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:"image",active:true,subCommand:[{name:"resize",version:"0.0.1",example:"dphelper.image.resize(img, 100, 100)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Resize an image to specified dimensions",env:"client",subCommand:[]},{name:"crop",version:"0.0.1",example:"dphelper.image.crop(img, { x: 0, y: 0, width: 100, height: 100 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Crop an image to specified region",env:"client",subCommand:[]},{name:"toDataURL",version:"0.0.1",example:"dphelper.image.toDataURL(img, 'image/webp', 0.8)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to data URL with optional format and quality",env:"client",subCommand:[]},{name:"fromDataURL",version:"0.0.1",example:"dphelper.image.fromDataURL(dataUrl)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Create an Image element from a data URL",env:"client",subCommand:[]},{name:"filter",version:"0.0.1",example:"dphelper.image.filter(img, { brightness: 1.2, contrast: 1.1 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply CSS filters to an image",env:"client",subCommand:[]},{name:"rotate",version:"0.0.1",example:"dphelper.image.rotate(img, 90)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Rotate an image by degrees",env:"client",subCommand:[]},{name:"flip",version:"0.0.1",example:"dphelper.image.flip(img, 'horizontal')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Flip an image horizontally or vertically",env:"client",subCommand:[]},{name:"grayscale",version:"0.0.1",example:"dphelper.image.grayscale(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to grayscale",env:"client",subCommand:[]},{name:"blur",version:"0.0.1",example:"dphelper.image.blur(img, 5)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply blur effect to an image",env:"client",subCommand:[]},{name:"getDimensions",version:"0.0.1",example:"dphelper.image.getDimensions(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get image dimensions",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.image.load('image.jpg')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Load an image from URL",env:"client",subCommand:[]},{name:"composite",version:"0.0.1",example:"dphelper.image.composite(img1, img2, 'multiply')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Composite two images together",env:"client",subCommand:[]}]},l=(e,t)=>{let a=document.createElement("canvas");return a.width=e,a.height=t,a},w=e=>({width:e.width,height:e.height}),g=e=>new Promise((t,a)=>{let n=new Image;n.onload=()=>t(n),n.onerror=a,n.src=e;}),y=(e,t,a,n="auto")=>{let r=l(t,a),i=r.getContext("2d");return i.imageSmoothingEnabled=n!=="pixelated",i.imageSmoothingQuality="high",i.drawImage(e,0,0,t,a),r.toDataURL("image/png")},D=(e,t)=>{let a=l(t.width,t.height);return a.getContext("2d").drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),a.toDataURL("image/png")},x=(e,t="image/png",a=.92)=>{let n=l(e.width,e.height),r=n.getContext("2d");return r.drawImage(e,0,0),n.toDataURL(t,a)},M=e=>g(e),p=(e,t)=>{let a=[];t.brightness!==void 0&&a.push(`brightness(${t.brightness})`),t.contrast!==void 0&&a.push(`contrast(${t.contrast})`),t.saturate!==void 0&&a.push(`saturate(${t.saturate})`),t.hueRotate!==void 0&&a.push(`hue-rotate(${t.hueRotate}deg)`),t.invert!==void 0&&a.push(`invert(${t.invert})`),t.sepia!==void 0&&a.push(`sepia(${t.sepia})`),t.blur!==void 0&&a.push(`blur(${t.blur}px)`),t.grayscale!==void 0&&a.push(`grayscale(${t.grayscale})`);let n=l(e.width,e.height),r=n.getContext("2d");return r.filter=a.join(" "),r.drawImage(e,0,0),n.toDataURL("image/png")},L=(e,t)=>{let a=t*Math.PI/180,n=Math.abs(Math.sin(a)),r=Math.abs(Math.cos(a)),i=e.width*r+e.height*n,m=e.width*n+e.height*r,c=l(i,m),o=c.getContext("2d");return o.translate(i/2,m/2),o.rotate(a),o.drawImage(e,-e.width/2,-e.height/2),c.toDataURL("image/png")},C=(e,t)=>{let a=l(e.width,e.height),n=a.getContext("2d");return t==="horizontal"?(n.translate(e.width,0),n.scale(-1,1)):(n.translate(0,e.height),n.scale(1,-1)),n.drawImage(e,0,0),a.toDataURL("image/png")},I=e=>p(e,{grayscale:1}),P=(e,t)=>p(e,{blur:t}),R=(e,t,a="source-over",n=0,r=0)=>{let i=Math.max(e.width,t.width+n),m=Math.max(e.height,t.height+r),c=l(i,m),o=c.getContext("2d");return o.drawImage(e,0,0),o.globalCompositeOperation=a,o.drawImage(t,n,r),c.toDataURL("image/png")},E={resize:y,crop:D,toDataURL:x,fromDataURL:M,filter:p,rotate:L,flip:C,grayscale:I,blur:P,getDimensions:w,load:g,composite:R};dphelper?.setDescription(v,E);var A=dphelper.image;exports.image=A;
1
+ 'use strict';var h={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.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...h},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 s=dphelper;Object.defineProperty(s,"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(s,"setDescription",{value:(e,t)=>{Object.defineProperties(s,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(s[e.name],{[a]:{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:"image",active:true,subCommand:[{name:"resize",version:"0.0.1",example:"dphelper.image.resize(img, 100, 100)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Resize an image to specified dimensions",env:"client",subCommand:[]},{name:"crop",version:"0.0.1",example:"dphelper.image.crop(img, { x: 0, y: 0, width: 100, height: 100 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Crop an image to specified region",env:"client",subCommand:[]},{name:"toDataURL",version:"0.0.1",example:"dphelper.image.toDataURL(img, 'image/webp', 0.8)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to data URL with optional format and quality",env:"client",subCommand:[]},{name:"fromDataURL",version:"0.0.1",example:"dphelper.image.fromDataURL(dataUrl)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Create an Image element from a data URL",env:"client",subCommand:[]},{name:"filter",version:"0.0.1",example:"dphelper.image.filter(img, { brightness: 1.2, contrast: 1.1 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply CSS filters to an image",env:"client",subCommand:[]},{name:"rotate",version:"0.0.1",example:"dphelper.image.rotate(img, 90)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Rotate an image by degrees",env:"client",subCommand:[]},{name:"flip",version:"0.0.1",example:"dphelper.image.flip(img, 'horizontal')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Flip an image horizontally or vertically",env:"client",subCommand:[]},{name:"grayscale",version:"0.0.1",example:"dphelper.image.grayscale(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to grayscale",env:"client",subCommand:[]},{name:"blur",version:"0.0.1",example:"dphelper.image.blur(img, 5)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply blur effect to an image",env:"client",subCommand:[]},{name:"getDimensions",version:"0.0.1",example:"dphelper.image.getDimensions(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get image dimensions",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.image.load('image.jpg')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Load an image from URL",env:"client",subCommand:[]},{name:"composite",version:"0.0.1",example:"dphelper.image.composite(img1, img2, 'multiply')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Composite two images together",env:"client",subCommand:[]}]},l=(e,t)=>{let a=document.createElement("canvas");return a.width=e,a.height=t,a},w=e=>({width:e.width,height:e.height}),g=e=>new Promise((t,a)=>{let n=new Image;n.onload=()=>t(n),n.onerror=a,n.src=e;}),y=(e,t,a,n="auto")=>{let r=l(t,a),i=r.getContext("2d");return i.imageSmoothingEnabled=n!=="pixelated",i.imageSmoothingQuality="high",i.drawImage(e,0,0,t,a),r.toDataURL("image/png")},D=(e,t)=>{let a=l(t.width,t.height);return a.getContext("2d").drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),a.toDataURL("image/png")},x=(e,t="image/png",a=.92)=>{let n=l(e.width,e.height),r=n.getContext("2d");return r.drawImage(e,0,0),n.toDataURL(t,a)},M=e=>g(e),p=(e,t)=>{let a=[];t.brightness!==void 0&&a.push(`brightness(${t.brightness})`),t.contrast!==void 0&&a.push(`contrast(${t.contrast})`),t.saturate!==void 0&&a.push(`saturate(${t.saturate})`),t.hueRotate!==void 0&&a.push(`hue-rotate(${t.hueRotate}deg)`),t.invert!==void 0&&a.push(`invert(${t.invert})`),t.sepia!==void 0&&a.push(`sepia(${t.sepia})`),t.blur!==void 0&&a.push(`blur(${t.blur}px)`),t.grayscale!==void 0&&a.push(`grayscale(${t.grayscale})`);let n=l(e.width,e.height),r=n.getContext("2d");return r.filter=a.join(" "),r.drawImage(e,0,0),n.toDataURL("image/png")},L=(e,t)=>{let a=t*Math.PI/180,n=Math.abs(Math.sin(a)),r=Math.abs(Math.cos(a)),i=e.width*r+e.height*n,m=e.width*n+e.height*r,c=l(i,m),o=c.getContext("2d");return o.translate(i/2,m/2),o.rotate(a),o.drawImage(e,-e.width/2,-e.height/2),c.toDataURL("image/png")},C=(e,t)=>{let a=l(e.width,e.height),n=a.getContext("2d");return t==="horizontal"?(n.translate(e.width,0),n.scale(-1,1)):(n.translate(0,e.height),n.scale(1,-1)),n.drawImage(e,0,0),a.toDataURL("image/png")},I=e=>p(e,{grayscale:1}),P=(e,t)=>p(e,{blur:t}),R=(e,t,a="source-over",n=0,r=0)=>{let i=Math.max(e.width,t.width+n),m=Math.max(e.height,t.height+r),c=l(i,m),o=c.getContext("2d");return o.drawImage(e,0,0),o.globalCompositeOperation=a,o.drawImage(t,n,r),c.toDataURL("image/png")},E={resize:y,crop:D,toDataURL:x,fromDataURL:M,filter:p,rotate:L,flip:C,grayscale:I,blur:P,getDimensions:w,load:g,composite:R};dphelper?.setDescription(v,E);var A=dphelper.image;exports.image=A;
package/modules/image.js CHANGED
@@ -1 +1 @@
1
- var d={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var g={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:g.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,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(s,"setDescription",{value:(e,t)=>{Object.defineProperties(s,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(s[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,e,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(e);}});var w={name:"image",active:true,subCommand:[{name:"resize",version:"0.0.1",example:"dphelper.image.resize(img, 100, 100)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Resize an image to specified dimensions",env:"client",subCommand:[]},{name:"crop",version:"0.0.1",example:"dphelper.image.crop(img, { x: 0, y: 0, width: 100, height: 100 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Crop an image to specified region",env:"client",subCommand:[]},{name:"toDataURL",version:"0.0.1",example:"dphelper.image.toDataURL(img, 'image/webp', 0.8)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to data URL with optional format and quality",env:"client",subCommand:[]},{name:"fromDataURL",version:"0.0.1",example:"dphelper.image.fromDataURL(dataUrl)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Create an Image element from a data URL",env:"client",subCommand:[]},{name:"filter",version:"0.0.1",example:"dphelper.image.filter(img, { brightness: 1.2, contrast: 1.1 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply CSS filters to an image",env:"client",subCommand:[]},{name:"rotate",version:"0.0.1",example:"dphelper.image.rotate(img, 90)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Rotate an image by degrees",env:"client",subCommand:[]},{name:"flip",version:"0.0.1",example:"dphelper.image.flip(img, 'horizontal')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Flip an image horizontally or vertically",env:"client",subCommand:[]},{name:"grayscale",version:"0.0.1",example:"dphelper.image.grayscale(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to grayscale",env:"client",subCommand:[]},{name:"blur",version:"0.0.1",example:"dphelper.image.blur(img, 5)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply blur effect to an image",env:"client",subCommand:[]},{name:"getDimensions",version:"0.0.1",example:"dphelper.image.getDimensions(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get image dimensions",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.image.load('image.jpg')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Load an image from URL",env:"client",subCommand:[]},{name:"composite",version:"0.0.1",example:"dphelper.image.composite(img1, img2, 'multiply')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Composite two images together",env:"client",subCommand:[]}]},l=(e,t)=>{let a=document.createElement("canvas");return a.width=e,a.height=t,a},y=e=>({width:e.width,height:e.height}),b=e=>new Promise((t,a)=>{let n=new Image;n.onload=()=>t(n),n.onerror=a,n.src=e;}),D=(e,t,a,n="auto")=>{let r=l(t,a),i=r.getContext("2d");return i.imageSmoothingEnabled=n!=="pixelated",i.imageSmoothingQuality="high",i.drawImage(e,0,0,t,a),r.toDataURL("image/png")},x=(e,t)=>{let a=l(t.width,t.height);return a.getContext("2d").drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),a.toDataURL("image/png")},M=(e,t="image/png",a=.92)=>{let n=l(e.width,e.height),r=n.getContext("2d");return r.drawImage(e,0,0),n.toDataURL(t,a)},L=e=>b(e),h=(e,t)=>{let a=[];t.brightness!==void 0&&a.push(`brightness(${t.brightness})`),t.contrast!==void 0&&a.push(`contrast(${t.contrast})`),t.saturate!==void 0&&a.push(`saturate(${t.saturate})`),t.hueRotate!==void 0&&a.push(`hue-rotate(${t.hueRotate}deg)`),t.invert!==void 0&&a.push(`invert(${t.invert})`),t.sepia!==void 0&&a.push(`sepia(${t.sepia})`),t.blur!==void 0&&a.push(`blur(${t.blur}px)`),t.grayscale!==void 0&&a.push(`grayscale(${t.grayscale})`);let n=l(e.width,e.height),r=n.getContext("2d");return r.filter=a.join(" "),r.drawImage(e,0,0),n.toDataURL("image/png")},C=(e,t)=>{let a=t*Math.PI/180,n=Math.abs(Math.sin(a)),r=Math.abs(Math.cos(a)),i=e.width*r+e.height*n,m=e.width*n+e.height*r,c=l(i,m),o=c.getContext("2d");return o.translate(i/2,m/2),o.rotate(a),o.drawImage(e,-e.width/2,-e.height/2),c.toDataURL("image/png")},I=(e,t)=>{let a=l(e.width,e.height),n=a.getContext("2d");return t==="horizontal"?(n.translate(e.width,0),n.scale(-1,1)):(n.translate(0,e.height),n.scale(1,-1)),n.drawImage(e,0,0),a.toDataURL("image/png")},P=e=>h(e,{grayscale:1}),R=(e,t)=>h(e,{blur:t}),E=(e,t,a="source-over",n=0,r=0)=>{let i=Math.max(e.width,t.width+n),m=Math.max(e.height,t.height+r),c=l(i,m),o=c.getContext("2d");return o.drawImage(e,0,0),o.globalCompositeOperation=a,o.drawImage(t,n,r),c.toDataURL("image/png")},H={resize:D,crop:x,toDataURL:M,fromDataURL:L,filter:h,rotate:C,flip:I,grayscale:P,blur:R,getDimensions:y,load:b,composite:E};dphelper?.setDescription(w,H);var q=dphelper.image;export{q as image};
1
+ var d={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var g={version:"4.6.2"};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:g.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,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(s,"setDescription",{value:(e,t)=>{Object.defineProperties(s,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(s[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,e,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(e);}});var w={name:"image",active:true,subCommand:[{name:"resize",version:"0.0.1",example:"dphelper.image.resize(img, 100, 100)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Resize an image to specified dimensions",env:"client",subCommand:[]},{name:"crop",version:"0.0.1",example:"dphelper.image.crop(img, { x: 0, y: 0, width: 100, height: 100 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Crop an image to specified region",env:"client",subCommand:[]},{name:"toDataURL",version:"0.0.1",example:"dphelper.image.toDataURL(img, 'image/webp', 0.8)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to data URL with optional format and quality",env:"client",subCommand:[]},{name:"fromDataURL",version:"0.0.1",example:"dphelper.image.fromDataURL(dataUrl)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Create an Image element from a data URL",env:"client",subCommand:[]},{name:"filter",version:"0.0.1",example:"dphelper.image.filter(img, { brightness: 1.2, contrast: 1.1 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply CSS filters to an image",env:"client",subCommand:[]},{name:"rotate",version:"0.0.1",example:"dphelper.image.rotate(img, 90)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Rotate an image by degrees",env:"client",subCommand:[]},{name:"flip",version:"0.0.1",example:"dphelper.image.flip(img, 'horizontal')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Flip an image horizontally or vertically",env:"client",subCommand:[]},{name:"grayscale",version:"0.0.1",example:"dphelper.image.grayscale(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to grayscale",env:"client",subCommand:[]},{name:"blur",version:"0.0.1",example:"dphelper.image.blur(img, 5)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply blur effect to an image",env:"client",subCommand:[]},{name:"getDimensions",version:"0.0.1",example:"dphelper.image.getDimensions(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get image dimensions",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.image.load('image.jpg')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Load an image from URL",env:"client",subCommand:[]},{name:"composite",version:"0.0.1",example:"dphelper.image.composite(img1, img2, 'multiply')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Composite two images together",env:"client",subCommand:[]}]},l=(e,t)=>{let a=document.createElement("canvas");return a.width=e,a.height=t,a},y=e=>({width:e.width,height:e.height}),b=e=>new Promise((t,a)=>{let n=new Image;n.onload=()=>t(n),n.onerror=a,n.src=e;}),D=(e,t,a,n="auto")=>{let r=l(t,a),i=r.getContext("2d");return i.imageSmoothingEnabled=n!=="pixelated",i.imageSmoothingQuality="high",i.drawImage(e,0,0,t,a),r.toDataURL("image/png")},x=(e,t)=>{let a=l(t.width,t.height);return a.getContext("2d").drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),a.toDataURL("image/png")},M=(e,t="image/png",a=.92)=>{let n=l(e.width,e.height),r=n.getContext("2d");return r.drawImage(e,0,0),n.toDataURL(t,a)},L=e=>b(e),h=(e,t)=>{let a=[];t.brightness!==void 0&&a.push(`brightness(${t.brightness})`),t.contrast!==void 0&&a.push(`contrast(${t.contrast})`),t.saturate!==void 0&&a.push(`saturate(${t.saturate})`),t.hueRotate!==void 0&&a.push(`hue-rotate(${t.hueRotate}deg)`),t.invert!==void 0&&a.push(`invert(${t.invert})`),t.sepia!==void 0&&a.push(`sepia(${t.sepia})`),t.blur!==void 0&&a.push(`blur(${t.blur}px)`),t.grayscale!==void 0&&a.push(`grayscale(${t.grayscale})`);let n=l(e.width,e.height),r=n.getContext("2d");return r.filter=a.join(" "),r.drawImage(e,0,0),n.toDataURL("image/png")},C=(e,t)=>{let a=t*Math.PI/180,n=Math.abs(Math.sin(a)),r=Math.abs(Math.cos(a)),i=e.width*r+e.height*n,m=e.width*n+e.height*r,c=l(i,m),o=c.getContext("2d");return o.translate(i/2,m/2),o.rotate(a),o.drawImage(e,-e.width/2,-e.height/2),c.toDataURL("image/png")},I=(e,t)=>{let a=l(e.width,e.height),n=a.getContext("2d");return t==="horizontal"?(n.translate(e.width,0),n.scale(-1,1)):(n.translate(0,e.height),n.scale(1,-1)),n.drawImage(e,0,0),a.toDataURL("image/png")},P=e=>h(e,{grayscale:1}),R=(e,t)=>h(e,{blur:t}),E=(e,t,a="source-over",n=0,r=0)=>{let i=Math.max(e.width,t.width+n),m=Math.max(e.height,t.height+r),c=l(i,m),o=c.getContext("2d");return o.drawImage(e,0,0),o.globalCompositeOperation=a,o.drawImage(t,n,r),c.toDataURL("image/png")},H={resize:D,crop:x,toDataURL:M,fromDataURL:L,filter:h,rotate:C,flip:I,grayscale:P,blur:R,getDimensions:y,load:b,composite:E};dphelper?.setDescription(w,H);var q=dphelper.image;export{q as image};
package/modules/json.cjs CHANGED
@@ -1,3 +1,3 @@
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 l=dphelper;Object.defineProperty(l,"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(l,"setDescription",{value:(e,t)=>{Object.defineProperties(l,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(l[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),l.setProps(l,e,{writable:false,configurable:false,enumerable:false}),l._list.scripts.push(e);}});var f={name:"json",active:true,subCommand:[{name:"counter",version:"0.0.2",example:"dphelper.json.counter()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Count occurrences of a key-value pair in a JSON object.",env:"both",subCommand:[]},{name:"toCsv",version:"0.0.2",example:"dphelper.json.toCsv()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Convert JSON data to CSV format.",env:"both",subCommand:[]},{name:"saveCsvAs",version:"0.0.2",example:"dphelper.json.saveCsvAs()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Save CSV data as a file.",env:"both",subCommand:[]},{name:"is",version:"0.0.2",example:"dphelper.json.is()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a string is valid JSON.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.json.parse()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Parse a JSON string.",env:"both",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.json.sanitize()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Sanitize a JSON string.",env:"both",subCommand:[]},{name:"sanitizeJsonValue",version:"0.0.2",example:"dphelper.json.sanitizeJsonValue()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Sanitize individual JSON values.",env:"both",subCommand:[]}]},h={counter:(e,t,a)=>e?t&&a?e.items&&Array.isArray(e.items)?e.items.filter(n=>n[t]===a).length:Object.keys(e).length:0:null,toCsv:e=>{let t=e,a=(o,s)=>s===null?"":s,n=Object.keys(t[0]),i=t.map(o=>n.map(s=>JSON.stringify(o[s],a)).join(","));return i.unshift(n.join(",")),i.join(`\r
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.2"};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 l=dphelper;Object.defineProperty(l,"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(l,"setDescription",{value:(e,t)=>{Object.defineProperties(l,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(l[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),l.setProps(l,e,{writable:false,configurable:false,enumerable:false}),l._list.scripts.push(e);}});var f={name:"json",active:true,subCommand:[{name:"counter",version:"0.0.2",example:"dphelper.json.counter()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Count occurrences of a key-value pair in a JSON object.",env:"both",subCommand:[]},{name:"toCsv",version:"0.0.2",example:"dphelper.json.toCsv()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Convert JSON data to CSV format.",env:"both",subCommand:[]},{name:"saveCsvAs",version:"0.0.2",example:"dphelper.json.saveCsvAs()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Save CSV data as a file.",env:"both",subCommand:[]},{name:"is",version:"0.0.2",example:"dphelper.json.is()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a string is valid JSON.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.json.parse()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Parse a JSON string.",env:"both",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.json.sanitize()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Sanitize a JSON string.",env:"both",subCommand:[]},{name:"sanitizeJsonValue",version:"0.0.2",example:"dphelper.json.sanitizeJsonValue()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Sanitize individual JSON values.",env:"both",subCommand:[]}]},h={counter:(e,t,a)=>e?t&&a?e.items&&Array.isArray(e.items)?e.items.filter(n=>n[t]===a).length:Object.keys(e).length:0:null,toCsv:e=>{let t=e,a=(o,s)=>s===null?"":s,n=Object.keys(t[0]),i=t.map(o=>n.map(s=>JSON.stringify(o[s],a)).join(","));return i.unshift(n.join(",")),i.join(`\r
2
2
  `)},saveCsvAs:(e,t)=>{let a=new Blob([e],{type:"text/csv;charset=utf-8;"}),n=document.createElement("a"),i=dphelper.date.dateTimeToString(new Date(Date.now())),o=`${t}_${i}.csv`,s=URL.createObjectURL(a);n.setAttribute("href",s),n.setAttribute("download",o),n.style.visibility="hidden",document.body.appendChild(n),n.click(),document.body.removeChild(n);},is:e=>{try{JSON.parse(e);}catch(t){return console.warn(t),false}return true},parse:e=>{try{return JSON.parse(e)}catch(t){return console.warn(t),"Json not parsable"}},sanitize:e=>e?"{"+e.trim().replace(/^\{/,"").replace(/\}$/,"").split(/,(?=(?:[^"]*"[^"]*")*[^"]*$)/).map(i=>{let[o,...s]=i.split(":"),d=dphelper.json.sanitizeJsonValue(o?.trim()??"");if(!o)return "";let r=s.join(":");return r?(r=r.trim(),r==="null"?r='""':r==="true"||r==="false"?r=`"${r}"`:/^\d+$/.test(r)?r=`"${r}"`:r=dphelper.json.sanitizeJsonValue(r)):r='""',`${d}:${r}`}).filter(i=>i!=="").join(",")+"}":"{}",sanitizeJsonValue:e=>e?`"${e.replace(/^"(.*)"$/,"$1").replace(/\\/g,"").replace(/\//g,"/").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/"/g,'\\"').replace(/\t/g," ").trim()}"`:'""'};dphelper?.setDescription(f,h);var J=dphelper.json;
3
3
  exports.json=J;
package/modules/json.js CHANGED
@@ -1,3 +1,3 @@
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 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:[],...u},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 l=dphelper;Object.defineProperty(l,"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(l,"setDescription",{value:(e,t)=>{Object.defineProperties(l,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(l[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),l.setProps(l,e,{writable:false,configurable:false,enumerable:false}),l._list.scripts.push(e);}});var h={name:"json",active:true,subCommand:[{name:"counter",version:"0.0.2",example:"dphelper.json.counter()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Count occurrences of a key-value pair in a JSON object.",env:"both",subCommand:[]},{name:"toCsv",version:"0.0.2",example:"dphelper.json.toCsv()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Convert JSON data to CSV format.",env:"both",subCommand:[]},{name:"saveCsvAs",version:"0.0.2",example:"dphelper.json.saveCsvAs()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Save CSV data as a file.",env:"both",subCommand:[]},{name:"is",version:"0.0.2",example:"dphelper.json.is()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a string is valid JSON.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.json.parse()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Parse a JSON string.",env:"both",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.json.sanitize()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Sanitize a JSON string.",env:"both",subCommand:[]},{name:"sanitizeJsonValue",version:"0.0.2",example:"dphelper.json.sanitizeJsonValue()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Sanitize individual JSON values.",env:"both",subCommand:[]}]},v={counter:(e,t,a)=>e?t&&a?e.items&&Array.isArray(e.items)?e.items.filter(n=>n[t]===a).length:Object.keys(e).length:0:null,toCsv:e=>{let t=e,a=(o,s)=>s===null?"":s,n=Object.keys(t[0]),i=t.map(o=>n.map(s=>JSON.stringify(o[s],a)).join(","));return i.unshift(n.join(",")),i.join(`\r
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 d={version:"4.6.2"};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:d.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var l=dphelper;Object.defineProperty(l,"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(l,"setDescription",{value:(e,t)=>{Object.defineProperties(l,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(l[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),l.setProps(l,e,{writable:false,configurable:false,enumerable:false}),l._list.scripts.push(e);}});var h={name:"json",active:true,subCommand:[{name:"counter",version:"0.0.2",example:"dphelper.json.counter()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Count occurrences of a key-value pair in a JSON object.",env:"both",subCommand:[]},{name:"toCsv",version:"0.0.2",example:"dphelper.json.toCsv()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Convert JSON data to CSV format.",env:"both",subCommand:[]},{name:"saveCsvAs",version:"0.0.2",example:"dphelper.json.saveCsvAs()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Save CSV data as a file.",env:"both",subCommand:[]},{name:"is",version:"0.0.2",example:"dphelper.json.is()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a string is valid JSON.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.json.parse()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Parse a JSON string.",env:"both",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.json.sanitize()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Sanitize a JSON string.",env:"both",subCommand:[]},{name:"sanitizeJsonValue",version:"0.0.2",example:"dphelper.json.sanitizeJsonValue()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Sanitize individual JSON values.",env:"both",subCommand:[]}]},v={counter:(e,t,a)=>e?t&&a?e.items&&Array.isArray(e.items)?e.items.filter(n=>n[t]===a).length:Object.keys(e).length:0:null,toCsv:e=>{let t=e,a=(o,s)=>s===null?"":s,n=Object.keys(t[0]),i=t.map(o=>n.map(s=>JSON.stringify(o[s],a)).join(","));return i.unshift(n.join(",")),i.join(`\r
2
2
  `)},saveCsvAs:(e,t)=>{let a=new Blob([e],{type:"text/csv;charset=utf-8;"}),n=document.createElement("a"),i=dphelper.date.dateTimeToString(new Date(Date.now())),o=`${t}_${i}.csv`,s=URL.createObjectURL(a);n.setAttribute("href",s),n.setAttribute("download",o),n.style.visibility="hidden",document.body.appendChild(n),n.click(),document.body.removeChild(n);},is:e=>{try{JSON.parse(e);}catch(t){return console.warn(t),false}return true},parse:e=>{try{return JSON.parse(e)}catch(t){return console.warn(t),"Json not parsable"}},sanitize:e=>e?"{"+e.trim().replace(/^\{/,"").replace(/\}$/,"").split(/,(?=(?:[^"]*"[^"]*")*[^"]*$)/).map(i=>{let[o,...s]=i.split(":"),m=dphelper.json.sanitizeJsonValue(o?.trim()??"");if(!o)return "";let r=s.join(":");return r?(r=r.trim(),r==="null"?r='""':r==="true"||r==="false"?r=`"${r}"`:/^\d+$/.test(r)?r=`"${r}"`:r=dphelper.json.sanitizeJsonValue(r)):r='""',`${m}:${r}`}).filter(i=>i!=="").join(",")+"}":"{}",sanitizeJsonValue:e=>e?`"${e.replace(/^"(.*)"$/,"$1").replace(/\\/g,"").replace(/\//g,"/").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/"/g,'\\"').replace(/\t/g," ").trim()}"`:'""'};dphelper?.setDescription(h,v);var k=dphelper.json;
3
3
  export{k as json};
package/modules/load.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var n={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var s={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...n},configurable:true,writable:true},version:{value:s.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var l=dphelper;Object.defineProperty(l,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(l,"setDescription",{value:(e,t)=>{Object.defineProperties(l,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(l[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),l.setProps(l,e,{writable:false,configurable:false,enumerable:false}),l._list.scripts.push(e);}});var f={name:"load",active:true,subCommand:[{name:"all",version:"0.0.3",example:"dphelper.load.all(import.meta.glob('./Scripts/*.ts', { eager: true }))",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260228",type:"function",active:true,description:"Load all files from a glob object (Vite/esbuild) or require context. If you add a 'cacheName', the list is stored in cache.",env:"client",subCommand:[]},{name:"file",version:"0.0.2",example:"dphelper.load.file(filePath)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:true,description:"Load a specific file.",env:"client",subCommand:[]},{name:"fileToElement",version:"0.0.2",example:"dphelper.load.fileToElement(filePath, elementSelector)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Load a file and insert its content into an element.",env:"client",subCommand:[]},{name:"script",version:"0.0.2",example:"dphelper.load.script(scripts, elementSelector)",author:"Dario Passariello",creationDate:"20240525",lastMod:"20240525",type:"function",active:true,description:"Append script tags to an element.",env:"client",subCommand:[]},{name:"toJson",version:"0.0.3",example:"dphelper.load.toJson(import.meta.glob('./router/*.ts', { eager: true }), 'router')",author:"Dario Passariello",creationDate:"20250101",lastMod:"20260228",type:"function",active:true,description:"Create JSON from folder recursion using glob object.",env:"client",subCommand:[]}]},c={all:(e,t="")=>{if(e){if(t&&!window.cacheName&&(window.cacheName=[]),typeof e=="object"&&!e.keys){for(let r in e)t&&window.cacheName.push(r);return}if(typeof e=="function"&&e.keys)for(let r of e.keys())t&&window.cacheName.push(r),e(r);}},file:()=>null,fileToElement:async(e,t)=>{try{let r=await dphelper.load.file(t),o=document.querySelector(e);o?o.innerHTML=dphelper.sanitize.html(r):console.error(`Element not found: ${e}`);}catch(r){console.error("Error loading file to element:",r);}},script:(e,t="html")=>{let r=document.querySelector(t);if(!r){console.error(`Element not found: ${t}`);return}for(let o of e){let i=document.createElement("script");i.src=o,i.async=true,i.defer=true,r.appendChild(i);}},toJson:(e,t="")=>{let r={};if(e){if(t&&(r[t]=[]),typeof e=="object"&&!e.keys)for(let o in e)t&&r[t]&&r[t].push(o);else if(typeof e=="function"&&e.keys)for(let o of e.keys())t&&r[t]&&r[t].push(o),e(o);!t||!r[t]||Object.defineProperty(window,t,{value:dphelper.array.pathToJson(r[t]),writable:false,enumerable:false,configurable:false});}}};dphelper?.setDescription?.(f,c);var k=dphelper.load;exports.load=k;
1
+ 'use strict';var n={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var s={version:"4.6.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...n},configurable:true,writable:true},version:{value:s.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var l=dphelper;Object.defineProperty(l,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(l,"setDescription",{value:(e,t)=>{Object.defineProperties(l,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(l[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),l.setProps(l,e,{writable:false,configurable:false,enumerable:false}),l._list.scripts.push(e);}});var f={name:"load",active:true,subCommand:[{name:"all",version:"0.0.3",example:"dphelper.load.all(import.meta.glob('./Scripts/*.ts', { eager: true }))",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260228",type:"function",active:true,description:"Load all files from a glob object (Vite/esbuild) or require context. If you add a 'cacheName', the list is stored in cache.",env:"client",subCommand:[]},{name:"file",version:"0.0.2",example:"dphelper.load.file(filePath)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:true,description:"Load a specific file.",env:"client",subCommand:[]},{name:"fileToElement",version:"0.0.2",example:"dphelper.load.fileToElement(filePath, elementSelector)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Load a file and insert its content into an element.",env:"client",subCommand:[]},{name:"script",version:"0.0.2",example:"dphelper.load.script(scripts, elementSelector)",author:"Dario Passariello",creationDate:"20240525",lastMod:"20240525",type:"function",active:true,description:"Append script tags to an element.",env:"client",subCommand:[]},{name:"toJson",version:"0.0.3",example:"dphelper.load.toJson(import.meta.glob('./router/*.ts', { eager: true }), 'router')",author:"Dario Passariello",creationDate:"20250101",lastMod:"20260228",type:"function",active:true,description:"Create JSON from folder recursion using glob object.",env:"client",subCommand:[]}]},c={all:(e,t="")=>{if(e){if(t&&!window.cacheName&&(window.cacheName=[]),typeof e=="object"&&!e.keys){for(let r in e)t&&window.cacheName.push(r);return}if(typeof e=="function"&&e.keys)for(let r of e.keys())t&&window.cacheName.push(r),e(r);}},file:()=>null,fileToElement:async(e,t)=>{try{let r=await dphelper.load.file(t),o=document.querySelector(e);o?o.innerHTML=dphelper.sanitize.html(r):console.error(`Element not found: ${e}`);}catch(r){console.error("Error loading file to element:",r);}},script:(e,t="html")=>{let r=document.querySelector(t);if(!r){console.error(`Element not found: ${t}`);return}for(let o of e){let i=document.createElement("script");i.src=o,i.async=true,i.defer=true,r.appendChild(i);}},toJson:(e,t="")=>{let r={};if(e){if(t&&(r[t]=[]),typeof e=="object"&&!e.keys)for(let o in e)t&&r[t]&&r[t].push(o);else if(typeof e=="function"&&e.keys)for(let o of e.keys())t&&r[t]&&r[t].push(o),e(o);!t||!r[t]||Object.defineProperty(window,t,{value:dphelper.array.pathToJson(r[t]),writable:false,enumerable:false,configurable:false});}}};dphelper?.setDescription?.(f,c);var k=dphelper.load;exports.load=k;
package/modules/load.js CHANGED
@@ -1 +1 @@
1
- var s={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:[],...s},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 l=dphelper;Object.defineProperty(l,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(l,"setDescription",{value:(e,t)=>{Object.defineProperties(l,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(l[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),l.setProps(l,e,{writable:false,configurable:false,enumerable:false}),l._list.scripts.push(e);}});var c={name:"load",active:true,subCommand:[{name:"all",version:"0.0.3",example:"dphelper.load.all(import.meta.glob('./Scripts/*.ts', { eager: true }))",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260228",type:"function",active:true,description:"Load all files from a glob object (Vite/esbuild) or require context. If you add a 'cacheName', the list is stored in cache.",env:"client",subCommand:[]},{name:"file",version:"0.0.2",example:"dphelper.load.file(filePath)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:true,description:"Load a specific file.",env:"client",subCommand:[]},{name:"fileToElement",version:"0.0.2",example:"dphelper.load.fileToElement(filePath, elementSelector)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Load a file and insert its content into an element.",env:"client",subCommand:[]},{name:"script",version:"0.0.2",example:"dphelper.load.script(scripts, elementSelector)",author:"Dario Passariello",creationDate:"20240525",lastMod:"20240525",type:"function",active:true,description:"Append script tags to an element.",env:"client",subCommand:[]},{name:"toJson",version:"0.0.3",example:"dphelper.load.toJson(import.meta.glob('./router/*.ts', { eager: true }), 'router')",author:"Dario Passariello",creationDate:"20250101",lastMod:"20260228",type:"function",active:true,description:"Create JSON from folder recursion using glob object.",env:"client",subCommand:[]}]},d={all:(e,t="")=>{if(e){if(t&&!window.cacheName&&(window.cacheName=[]),typeof e=="object"&&!e.keys){for(let r in e)t&&window.cacheName.push(r);return}if(typeof e=="function"&&e.keys)for(let r of e.keys())t&&window.cacheName.push(r),e(r);}},file:()=>null,fileToElement:async(e,t)=>{try{let r=await dphelper.load.file(t),o=document.querySelector(e);o?o.innerHTML=dphelper.sanitize.html(r):console.error(`Element not found: ${e}`);}catch(r){console.error("Error loading file to element:",r);}},script:(e,t="html")=>{let r=document.querySelector(t);if(!r){console.error(`Element not found: ${t}`);return}for(let o of e){let i=document.createElement("script");i.src=o,i.async=true,i.defer=true,r.appendChild(i);}},toJson:(e,t="")=>{let r={};if(e){if(t&&(r[t]=[]),typeof e=="object"&&!e.keys)for(let o in e)t&&r[t]&&r[t].push(o);else if(typeof e=="function"&&e.keys)for(let o of e.keys())t&&r[t]&&r[t].push(o),e(o);!t||!r[t]||Object.defineProperty(window,t,{value:dphelper.array.pathToJson(r[t]),writable:false,enumerable:false,configurable:false});}}};dphelper?.setDescription?.(c,d);var D=dphelper.load;export{D as load};
1
+ var s={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.2"};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:p.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var l=dphelper;Object.defineProperty(l,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(l,"setDescription",{value:(e,t)=>{Object.defineProperties(l,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(l[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),l.setProps(l,e,{writable:false,configurable:false,enumerable:false}),l._list.scripts.push(e);}});var c={name:"load",active:true,subCommand:[{name:"all",version:"0.0.3",example:"dphelper.load.all(import.meta.glob('./Scripts/*.ts', { eager: true }))",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260228",type:"function",active:true,description:"Load all files from a glob object (Vite/esbuild) or require context. If you add a 'cacheName', the list is stored in cache.",env:"client",subCommand:[]},{name:"file",version:"0.0.2",example:"dphelper.load.file(filePath)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:true,description:"Load a specific file.",env:"client",subCommand:[]},{name:"fileToElement",version:"0.0.2",example:"dphelper.load.fileToElement(filePath, elementSelector)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Load a file and insert its content into an element.",env:"client",subCommand:[]},{name:"script",version:"0.0.2",example:"dphelper.load.script(scripts, elementSelector)",author:"Dario Passariello",creationDate:"20240525",lastMod:"20240525",type:"function",active:true,description:"Append script tags to an element.",env:"client",subCommand:[]},{name:"toJson",version:"0.0.3",example:"dphelper.load.toJson(import.meta.glob('./router/*.ts', { eager: true }), 'router')",author:"Dario Passariello",creationDate:"20250101",lastMod:"20260228",type:"function",active:true,description:"Create JSON from folder recursion using glob object.",env:"client",subCommand:[]}]},d={all:(e,t="")=>{if(e){if(t&&!window.cacheName&&(window.cacheName=[]),typeof e=="object"&&!e.keys){for(let r in e)t&&window.cacheName.push(r);return}if(typeof e=="function"&&e.keys)for(let r of e.keys())t&&window.cacheName.push(r),e(r);}},file:()=>null,fileToElement:async(e,t)=>{try{let r=await dphelper.load.file(t),o=document.querySelector(e);o?o.innerHTML=dphelper.sanitize.html(r):console.error(`Element not found: ${e}`);}catch(r){console.error("Error loading file to element:",r);}},script:(e,t="html")=>{let r=document.querySelector(t);if(!r){console.error(`Element not found: ${t}`);return}for(let o of e){let i=document.createElement("script");i.src=o,i.async=true,i.defer=true,r.appendChild(i);}},toJson:(e,t="")=>{let r={};if(e){if(t&&(r[t]=[]),typeof e=="object"&&!e.keys)for(let o in e)t&&r[t]&&r[t].push(o);else if(typeof e=="function"&&e.keys)for(let o of e.keys())t&&r[t]&&r[t].push(o),e(o);!t||!r[t]||Object.defineProperty(window,t,{value:dphelper.array.pathToJson(r[t]),writable:false,enumerable:false,configurable:false});}}};dphelper?.setDescription?.(c,d);var D=dphelper.load;export{D as load};
@@ -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 i={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:i.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,o,l)=>{Object.defineProperty(e,o.name,l||{writable:false,configurable:false,enumerable:false}),l?.lock&&Object.freeze(e[o.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(r,"setDescription",{value:(e,o)=>{Object.defineProperties(r,{[e.name]:{value:o,writable:false,configurable:false,enumerable:false}}),Object.keys(o).map(l=>(Object.defineProperties(r[e.name],{[l]:{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:"log",active:true,subCommand:[{name:"list",version:"0.0.2",example:"dphelper.log.list()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"List all log entries.",env:"both",subCommand:[]},{name:"reg",version:"0.0.2",example:"dphelper.log.reg('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Log a regular message.",env:"both",subCommand:[]},{name:"debug",version:"0.0.2",example:"dphelper.log.debug('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Log a debug message.",env:"both",subCommand:[]},{name:"error",version:"0.0.2",example:"dphelper.log.error('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Log an error message.",env:"both",subCommand:[]}]},t={log:[]},u={list:()=>t.log,reg:e=>{t.log.push({type:"reg",message:e}),t.log.length>1e3&&t.log.shift();},debug:e=>{t.log.push({type:"debug",message:e}),t.log.length>1e3&&t.log.shift();},error:e=>{t.log.push({type:"error",message:e}),t.log.length>1e3&&t.log.shift();}};Object.defineProperty(t,"log",{writable:false,enumerable:false,configurable:false});dphelper?.setDescription(g,u);var P=dphelper.logging;exports.logging=P;
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 i={version:"4.6.2"};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:i.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,o,l)=>{Object.defineProperty(e,o.name,l||{writable:false,configurable:false,enumerable:false}),l?.lock&&Object.freeze(e[o.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(r,"setDescription",{value:(e,o)=>{Object.defineProperties(r,{[e.name]:{value:o,writable:false,configurable:false,enumerable:false}}),Object.keys(o).map(l=>(Object.defineProperties(r[e.name],{[l]:{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:"log",active:true,subCommand:[{name:"list",version:"0.0.2",example:"dphelper.log.list()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"List all log entries.",env:"both",subCommand:[]},{name:"reg",version:"0.0.2",example:"dphelper.log.reg('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Log a regular message.",env:"both",subCommand:[]},{name:"debug",version:"0.0.2",example:"dphelper.log.debug('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Log a debug message.",env:"both",subCommand:[]},{name:"error",version:"0.0.2",example:"dphelper.log.error('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Log an error message.",env:"both",subCommand:[]}]},t={log:[]},u={list:()=>t.log,reg:e=>{t.log.push({type:"reg",message:e}),t.log.length>1e3&&t.log.shift();},debug:e=>{t.log.push({type:"debug",message:e}),t.log.length>1e3&&t.log.shift();},error:e=>{t.log.push({type:"error",message:e}),t.log.length>1e3&&t.log.shift();}};Object.defineProperty(t,"log",{writable:false,enumerable:false,configurable:false});dphelper?.setDescription(g,u);var P=dphelper.logging;exports.logging=P;
@@ -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 n={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:n.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,o,l)=>{Object.defineProperty(e,o.name,l||{writable:false,configurable:false,enumerable:false}),l?.lock&&Object.freeze(e[o.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(r,"setDescription",{value:(e,o)=>{Object.defineProperties(r,{[e.name]:{value:o,writable:false,configurable:false,enumerable:false}}),Object.keys(o).map(l=>(Object.defineProperties(r[e.name],{[l]:{writable:false,configurable:false,enumerable:false}}),null)),r.setProps(r,e,{writable:false,configurable:false,enumerable:false}),r._list.scripts.push(e);}});var u={name:"log",active:true,subCommand:[{name:"list",version:"0.0.2",example:"dphelper.log.list()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"List all log entries.",env:"both",subCommand:[]},{name:"reg",version:"0.0.2",example:"dphelper.log.reg('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Log a regular message.",env:"both",subCommand:[]},{name:"debug",version:"0.0.2",example:"dphelper.log.debug('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Log a debug message.",env:"both",subCommand:[]},{name:"error",version:"0.0.2",example:"dphelper.log.error('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Log an error message.",env:"both",subCommand:[]}]},t={log:[]},c={list:()=>t.log,reg:e=>{t.log.push({type:"reg",message:e}),t.log.length>1e3&&t.log.shift();},debug:e=>{t.log.push({type:"debug",message:e}),t.log.length>1e3&&t.log.shift();},error:e=>{t.log.push({type:"error",message:e}),t.log.length>1e3&&t.log.shift();}};Object.defineProperty(t,"log",{writable:false,enumerable:false,configurable:false});dphelper?.setDescription(u,c);var D=dphelper.logging;export{D as logging};
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 n={version:"4.6.2"};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:n.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,o,l)=>{Object.defineProperty(e,o.name,l||{writable:false,configurable:false,enumerable:false}),l?.lock&&Object.freeze(e[o.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(r,"setDescription",{value:(e,o)=>{Object.defineProperties(r,{[e.name]:{value:o,writable:false,configurable:false,enumerable:false}}),Object.keys(o).map(l=>(Object.defineProperties(r[e.name],{[l]:{writable:false,configurable:false,enumerable:false}}),null)),r.setProps(r,e,{writable:false,configurable:false,enumerable:false}),r._list.scripts.push(e);}});var u={name:"log",active:true,subCommand:[{name:"list",version:"0.0.2",example:"dphelper.log.list()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"List all log entries.",env:"both",subCommand:[]},{name:"reg",version:"0.0.2",example:"dphelper.log.reg('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Log a regular message.",env:"both",subCommand:[]},{name:"debug",version:"0.0.2",example:"dphelper.log.debug('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Log a debug message.",env:"both",subCommand:[]},{name:"error",version:"0.0.2",example:"dphelper.log.error('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Log an error message.",env:"both",subCommand:[]}]},t={log:[]},c={list:()=>t.log,reg:e=>{t.log.push({type:"reg",message:e}),t.log.length>1e3&&t.log.shift();},debug:e=>{t.log.push({type:"debug",message:e}),t.log.length>1e3&&t.log.shift();},error:e=>{t.log.push({type:"error",message:e}),t.log.length>1e3&&t.log.shift();}};Object.defineProperty(t,"log",{writable:false,enumerable:false,configurable:false});dphelper?.setDescription(u,c);var D=dphelper.logging;export{D as logging};
package/modules/math.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var l={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var n={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...l},configurable:true,writable:true},version:{value:n.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,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(r,"setDescription",{value:(e,t)=>{Object.defineProperties(r,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(r[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),r.setProps(r,e,{writable:false,configurable:false,enumerable:false}),r._list.scripts.push(e);}});var p={name:"math",active:true,subCommand:[{name:"rnd",version:"0.0.2",example:"dphelper.math.rnd()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Generate a random number.",env:"both",subCommand:[]},{name:"tmr",version:"0.0.2",example:"dphelper.math.tmr()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Measure the time taken by a function.",env:"both",subCommand:[]},{name:"isOdd",version:"0.0.2",example:"dphelper.math.isOdd(a)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a number is odd.",env:"both",subCommand:[]},{name:"percent",version:"0.0.2",example:"dphelper.math.percent([n, tot])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculate the percentage of a number relative to a total. Example: total: 100, number: 25 -> 25%",env:"both",subCommand:[]},{name:"isPrime",version:"0.0.2",example:"dphelper.math.isPrime(a)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a number is prime.",env:"both",subCommand:[]}]},u={rnd:()=>Math.floor(1e5+Math.random()*dphelper.math.tmr()),tmr:()=>Math.round(dphelper.date.epoch()/1e3),isOdd:e=>Number(e)%2!==0,percent:(e,t)=>{if(t===0)throw new Error("Total cannot be zero");return Number(e)/Number(t)*100},isPrime:e=>{if(Number(e)<=1)return false;for(let t=2;t<=Math.sqrt(Number(e));t++)if(Number(e)%t===0)return false;return true}};dphelper?.setDescription(p,u);var P=dphelper.math;exports.math=P;
1
+ 'use strict';var l={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var n={version:"4.6.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...l},configurable:true,writable:true},version:{value:n.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,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(r,"setDescription",{value:(e,t)=>{Object.defineProperties(r,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(r[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),r.setProps(r,e,{writable:false,configurable:false,enumerable:false}),r._list.scripts.push(e);}});var p={name:"math",active:true,subCommand:[{name:"rnd",version:"0.0.2",example:"dphelper.math.rnd()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Generate a random number.",env:"both",subCommand:[]},{name:"tmr",version:"0.0.2",example:"dphelper.math.tmr()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Measure the time taken by a function.",env:"both",subCommand:[]},{name:"isOdd",version:"0.0.2",example:"dphelper.math.isOdd(a)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a number is odd.",env:"both",subCommand:[]},{name:"percent",version:"0.0.2",example:"dphelper.math.percent([n, tot])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculate the percentage of a number relative to a total. Example: total: 100, number: 25 -> 25%",env:"both",subCommand:[]},{name:"isPrime",version:"0.0.2",example:"dphelper.math.isPrime(a)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a number is prime.",env:"both",subCommand:[]}]},u={rnd:()=>Math.floor(1e5+Math.random()*dphelper.math.tmr()),tmr:()=>Math.round(dphelper.date.epoch()/1e3),isOdd:e=>Number(e)%2!==0,percent:(e,t)=>{if(t===0)throw new Error("Total cannot be zero");return Number(e)/Number(t)*100},isPrime:e=>{if(Number(e)<=1)return false;for(let t=2;t<=Math.sqrt(Number(e));t++)if(Number(e)%t===0)return false;return true}};dphelper?.setDescription(p,u);var P=dphelper.math;exports.math=P;
package/modules/math.js CHANGED
@@ -1 +1 @@
1
- var n={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var i={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...n},configurable:true,writable:true},version:{value:i.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,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(r,"setDescription",{value:(e,t)=>{Object.defineProperties(r,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(r[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),r.setProps(r,e,{writable:false,configurable:false,enumerable:false}),r._list.scripts.push(e);}});var u={name:"math",active:true,subCommand:[{name:"rnd",version:"0.0.2",example:"dphelper.math.rnd()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Generate a random number.",env:"both",subCommand:[]},{name:"tmr",version:"0.0.2",example:"dphelper.math.tmr()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Measure the time taken by a function.",env:"both",subCommand:[]},{name:"isOdd",version:"0.0.2",example:"dphelper.math.isOdd(a)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a number is odd.",env:"both",subCommand:[]},{name:"percent",version:"0.0.2",example:"dphelper.math.percent([n, tot])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculate the percentage of a number relative to a total. Example: total: 100, number: 25 -> 25%",env:"both",subCommand:[]},{name:"isPrime",version:"0.0.2",example:"dphelper.math.isPrime(a)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a number is prime.",env:"both",subCommand:[]}]},m={rnd:()=>Math.floor(1e5+Math.random()*dphelper.math.tmr()),tmr:()=>Math.round(dphelper.date.epoch()/1e3),isOdd:e=>Number(e)%2!==0,percent:(e,t)=>{if(t===0)throw new Error("Total cannot be zero");return Number(e)/Number(t)*100},isPrime:e=>{if(Number(e)<=1)return false;for(let t=2;t<=Math.sqrt(Number(e));t++)if(Number(e)%t===0)return false;return true}};dphelper?.setDescription(u,m);var j=dphelper.math;export{j as math};
1
+ var n={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var i={version:"4.6.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...n},configurable:true,writable:true},version:{value:i.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,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(r,"setDescription",{value:(e,t)=>{Object.defineProperties(r,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(r[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),r.setProps(r,e,{writable:false,configurable:false,enumerable:false}),r._list.scripts.push(e);}});var u={name:"math",active:true,subCommand:[{name:"rnd",version:"0.0.2",example:"dphelper.math.rnd()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Generate a random number.",env:"both",subCommand:[]},{name:"tmr",version:"0.0.2",example:"dphelper.math.tmr()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Measure the time taken by a function.",env:"both",subCommand:[]},{name:"isOdd",version:"0.0.2",example:"dphelper.math.isOdd(a)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a number is odd.",env:"both",subCommand:[]},{name:"percent",version:"0.0.2",example:"dphelper.math.percent([n, tot])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculate the percentage of a number relative to a total. Example: total: 100, number: 25 -> 25%",env:"both",subCommand:[]},{name:"isPrime",version:"0.0.2",example:"dphelper.math.isPrime(a)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a number is prime.",env:"both",subCommand:[]}]},m={rnd:()=>Math.floor(1e5+Math.random()*dphelper.math.tmr()),tmr:()=>Math.round(dphelper.date.epoch()/1e3),isOdd:e=>Number(e)%2!==0,percent:(e,t)=>{if(t===0)throw new Error("Total cannot be zero");return Number(e)/Number(t)*100},isPrime:e=>{if(Number(e)<=1)return false;for(let t=2;t<=Math.sqrt(Number(e));t++)if(Number(e)%t===0)return false;return true}};dphelper?.setDescription(u,m);var j=dphelper.math;export{j as math};
@@ -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.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 a=dphelper;Object.defineProperty(a,"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(a,"setDescription",{value:(e,r)=>{Object.defineProperties(a,{[e.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(t=>(Object.defineProperties(a[e.name],{[t]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,e,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(e);}});var f={name:"memory",active:true,subCommand:[{name:"lock",version:"0.0.2",example:"dphelper.memory.lock('state[key]')",author:"Dario Passariello",creationDate:"20230101",lastMod:"20230111",type:"function",active:true,description:"Lock a state",env:"client",subCommand:[]},{name:"unlock",version:"0.0.2",example:"dphelper.memory.unlock('state[key]')",author:"Dario Passariello",creationDate:"20230101",lastMod:"20230111",type:"function",active:true,description:"Unlock a state",env:"client",subCommand:[]}]},b={lock:e=>{if(!e)return;let r=window,t=e.split(".");if(t.length<2)return;let o=t[0],l=t[1];if(!o||!l)return;let n=r[o];n&&Object.defineProperty(n,l,{writable:false,configurable:false});},unlock:e=>{if(!e)return;let r=window,t=e.split(".");if(t.length<2)return;let o=t[0],l=t[1];if(!o||!l)return;let n=r[o];if(n)try{Object.defineProperty(n,l,{writable:!0,configurable:!0});}catch{}}};dphelper?.setDescription(f,b);var D=dphelper.memory;exports.memory=D;
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.2"};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 a=dphelper;Object.defineProperty(a,"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(a,"setDescription",{value:(e,r)=>{Object.defineProperties(a,{[e.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(t=>(Object.defineProperties(a[e.name],{[t]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,e,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(e);}});var f={name:"memory",active:true,subCommand:[{name:"lock",version:"0.0.2",example:"dphelper.memory.lock('state[key]')",author:"Dario Passariello",creationDate:"20230101",lastMod:"20230111",type:"function",active:true,description:"Lock a state",env:"client",subCommand:[]},{name:"unlock",version:"0.0.2",example:"dphelper.memory.unlock('state[key]')",author:"Dario Passariello",creationDate:"20230101",lastMod:"20230111",type:"function",active:true,description:"Unlock a state",env:"client",subCommand:[]}]},b={lock:e=>{if(!e)return;let r=window,t=e.split(".");if(t.length<2)return;let o=t[0],l=t[1];if(!o||!l)return;let n=r[o];n&&Object.defineProperty(n,l,{writable:false,configurable:false});},unlock:e=>{if(!e)return;let r=window,t=e.split(".");if(t.length<2)return;let o=t[0],l=t[1];if(!o||!l)return;let n=r[o];if(n)try{Object.defineProperty(n,l,{writable:!0,configurable:!0});}catch{}}};dphelper?.setDescription(f,b);var D=dphelper.memory;exports.memory=D;
package/modules/memory.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.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 a=dphelper;Object.defineProperty(a,"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(a,"setDescription",{value:(e,r)=>{Object.defineProperties(a,{[e.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(t=>(Object.defineProperties(a[e.name],{[t]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,e,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(e);}});var b={name:"memory",active:true,subCommand:[{name:"lock",version:"0.0.2",example:"dphelper.memory.lock('state[key]')",author:"Dario Passariello",creationDate:"20230101",lastMod:"20230111",type:"function",active:true,description:"Lock a state",env:"client",subCommand:[]},{name:"unlock",version:"0.0.2",example:"dphelper.memory.unlock('state[key]')",author:"Dario Passariello",creationDate:"20230101",lastMod:"20230111",type:"function",active:true,description:"Unlock a state",env:"client",subCommand:[]}]},m={lock:e=>{if(!e)return;let r=window,t=e.split(".");if(t.length<2)return;let o=t[0],l=t[1];if(!o||!l)return;let n=r[o];n&&Object.defineProperty(n,l,{writable:false,configurable:false});},unlock:e=>{if(!e)return;let r=window,t=e.split(".");if(t.length<2)return;let o=t[0],l=t[1];if(!o||!l)return;let n=r[o];if(n)try{Object.defineProperty(n,l,{writable:!0,configurable:!0});}catch{}}};dphelper?.setDescription(b,m);var x=dphelper.memory;export{x as memory};
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.2"};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 a=dphelper;Object.defineProperty(a,"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(a,"setDescription",{value:(e,r)=>{Object.defineProperties(a,{[e.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(t=>(Object.defineProperties(a[e.name],{[t]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,e,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(e);}});var b={name:"memory",active:true,subCommand:[{name:"lock",version:"0.0.2",example:"dphelper.memory.lock('state[key]')",author:"Dario Passariello",creationDate:"20230101",lastMod:"20230111",type:"function",active:true,description:"Lock a state",env:"client",subCommand:[]},{name:"unlock",version:"0.0.2",example:"dphelper.memory.unlock('state[key]')",author:"Dario Passariello",creationDate:"20230101",lastMod:"20230111",type:"function",active:true,description:"Unlock a state",env:"client",subCommand:[]}]},m={lock:e=>{if(!e)return;let r=window,t=e.split(".");if(t.length<2)return;let o=t[0],l=t[1];if(!o||!l)return;let n=r[o];n&&Object.defineProperty(n,l,{writable:false,configurable:false});},unlock:e=>{if(!e)return;let r=window,t=e.split(".");if(t.length<2)return;let o=t[0],l=t[1];if(!o||!l)return;let n=r[o];if(n)try{Object.defineProperty(n,l,{writable:!0,configurable:!0});}catch{}}};dphelper?.setDescription(b,m);var x=dphelper.memory;export{x as memory};
@@ -1,2 +1,2 @@
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 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:[],...d},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 s=dphelper;Object.defineProperty(s,"setProps",{value:(e,n,a)=>{Object.defineProperty(e,n.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[n.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(e,n)=>{Object.defineProperties(s,{[e.name]:{value:n,writable:false,configurable:false,enumerable:false}}),Object.keys(n).map(a=>(Object.defineProperties(s[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,e,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(e);}});var w={name:"navigation",active:true,subCommand:[{name:"ajax",version:"0.0.2",example:"dphelper.navigation.ajax()",author:"Dario Passariello",creationDate:"20260223",lastMod:"20260223",type:"function",active:true,description:"Vanilla AJAX Single Page Application (SPA) navigation engine.",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.navigation.load('/home')",author:"Dario Passariello",creationDate:"20260223",lastMod:"20260223",type:"function",active:true,description:"Loads a page via AJAX and injects it into the body.",env:"client",subCommand:[]}]},y={load:async e=>{let a=document.body,o=e.startsWith("/")?e.split("/")[1]||"home":e;if((!o||o==="")&&(o="home"),!document.querySelector(".loader")){let t=document.createElement("div");t.className="loader",t.innerHTML="<i></i>",t.style.opacity="0",t.style.transition="opacity 1000ms",a.appendChild(t),setTimeout(()=>t.style.opacity="1",10);}try{let t=await fetch(`${o}/`);if(!t.ok)throw new Error("Page not found");let i=await t.text(),r=i.match(/<body[^>]*>([\s\S]*)<\/body>/i),p=r?r[1]:i,m=f=>{let h=document.createElement("div");return h.textContent=f,h.innerHTML},b=dphelper?.sanitize?.html?dphelper.sanitize.html(p||""):m(p||"");a.innerHTML=b,window.scrollTo({top:0,behavior:"smooth"}),document.title=o.charAt(0).toUpperCase()+o.slice(1);let l=dphelper.path.rail();l&&l.length>0&&(a.className=a.className.replace(/path-\w+/g,"").trim(),a.classList.add(`path-${l[l.length-1]}`)),dphelper.navigation.ajax_running&&dphelper.navigation.ajax();}catch(t){console.error("Navigation error:",t);let i=window.location.origin;e.startsWith("/")&&!e.startsWith("//")&&!e.match(/^[a-zA-Z]:/)&&new URL(e,i).href.startsWith(i)&&(window.location.href=e);}},_bind:e=>{document.querySelectorAll(e).forEach(a=>{let o=a.getAttribute("href");if(!o||!o.startsWith("/")||o.includes("#"))return;let t=a.cloneNode(true);a.parentNode?.replaceChild(t,a),t.addEventListener("mouseup",i=>{let r=t.getAttribute("data-href")||o;history.pushState({href:r},"",r),dphelper.navigation.load(r),t.removeAttribute("href"),i.stopPropagation();});});},ajax:()=>{if(dphelper.navigation.ajax_running){dphelper.navigation._bind("a");return}dphelper.navigation.ajax_running=true,window.onpopstate=()=>dphelper.navigation.load(window.location.pathname),dphelper.navigation._bind("a"),globalThis.dp_hash_listener_set||(window.addEventListener("hashchange",()=>{let e=window.location.hash.substring(1);e&&document.getElementById(e)?.scrollIntoView({behavior:"smooth"});}),globalThis.dp_hash_listener_set=true);}};dphelper?.setDescription(w,y);var C=dphelper.navigation;
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 u={version:"4.6.2"};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:u.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,n,a)=>{Object.defineProperty(e,n.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[n.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(e,n)=>{Object.defineProperties(s,{[e.name]:{value:n,writable:false,configurable:false,enumerable:false}}),Object.keys(n).map(a=>(Object.defineProperties(s[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,e,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(e);}});var w={name:"navigation",active:true,subCommand:[{name:"ajax",version:"0.0.2",example:"dphelper.navigation.ajax()",author:"Dario Passariello",creationDate:"20260223",lastMod:"20260223",type:"function",active:true,description:"Vanilla AJAX Single Page Application (SPA) navigation engine.",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.navigation.load('/home')",author:"Dario Passariello",creationDate:"20260223",lastMod:"20260223",type:"function",active:true,description:"Loads a page via AJAX and injects it into the body.",env:"client",subCommand:[]}]},y={load:async e=>{let a=document.body,o=e.startsWith("/")?e.split("/")[1]||"home":e;if((!o||o==="")&&(o="home"),!document.querySelector(".loader")){let t=document.createElement("div");t.className="loader",t.innerHTML="<i></i>",t.style.opacity="0",t.style.transition="opacity 1000ms",a.appendChild(t),setTimeout(()=>t.style.opacity="1",10);}try{let t=await fetch(`${o}/`);if(!t.ok)throw new Error("Page not found");let i=await t.text(),r=i.match(/<body[^>]*>([\s\S]*)<\/body>/i),p=r?r[1]:i,m=f=>{let h=document.createElement("div");return h.textContent=f,h.innerHTML},b=dphelper?.sanitize?.html?dphelper.sanitize.html(p||""):m(p||"");a.innerHTML=b,window.scrollTo({top:0,behavior:"smooth"}),document.title=o.charAt(0).toUpperCase()+o.slice(1);let l=dphelper.path.rail();l&&l.length>0&&(a.className=a.className.replace(/path-\w+/g,"").trim(),a.classList.add(`path-${l[l.length-1]}`)),dphelper.navigation.ajax_running&&dphelper.navigation.ajax();}catch(t){console.error("Navigation error:",t);let i=window.location.origin;e.startsWith("/")&&!e.startsWith("//")&&!e.match(/^[a-zA-Z]:/)&&new URL(e,i).href.startsWith(i)&&(window.location.href=e);}},_bind:e=>{document.querySelectorAll(e).forEach(a=>{let o=a.getAttribute("href");if(!o||!o.startsWith("/")||o.includes("#"))return;let t=a.cloneNode(true);a.parentNode?.replaceChild(t,a),t.addEventListener("mouseup",i=>{let r=t.getAttribute("data-href")||o;history.pushState({href:r},"",r),dphelper.navigation.load(r),t.removeAttribute("href"),i.stopPropagation();});});},ajax:()=>{if(dphelper.navigation.ajax_running){dphelper.navigation._bind("a");return}dphelper.navigation.ajax_running=true,window.onpopstate=()=>dphelper.navigation.load(window.location.pathname),dphelper.navigation._bind("a"),globalThis.dp_hash_listener_set||(window.addEventListener("hashchange",()=>{let e=window.location.hash.substring(1);e&&document.getElementById(e)?.scrollIntoView({behavior:"smooth"});}),globalThis.dp_hash_listener_set=true);}};dphelper?.setDescription(w,y);var C=dphelper.navigation;
2
2
  exports.navigation=C;
@@ -1,2 +1,2 @@
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 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:[],...u},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 s=dphelper;Object.defineProperty(s,"setProps",{value:(e,n,a)=>{Object.defineProperty(e,n.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[n.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(e,n)=>{Object.defineProperties(s,{[e.name]:{value:n,writable:false,configurable:false,enumerable:false}}),Object.keys(n).map(a=>(Object.defineProperties(s[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,e,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(e);}});var y={name:"navigation",active:true,subCommand:[{name:"ajax",version:"0.0.2",example:"dphelper.navigation.ajax()",author:"Dario Passariello",creationDate:"20260223",lastMod:"20260223",type:"function",active:true,description:"Vanilla AJAX Single Page Application (SPA) navigation engine.",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.navigation.load('/home')",author:"Dario Passariello",creationDate:"20260223",lastMod:"20260223",type:"function",active:true,description:"Loads a page via AJAX and injects it into the body.",env:"client",subCommand:[]}]},j={load:async e=>{let a=document.body,o=e.startsWith("/")?e.split("/")[1]||"home":e;if((!o||o==="")&&(o="home"),!document.querySelector(".loader")){let t=document.createElement("div");t.className="loader",t.innerHTML="<i></i>",t.style.opacity="0",t.style.transition="opacity 1000ms",a.appendChild(t),setTimeout(()=>t.style.opacity="1",10);}try{let t=await fetch(`${o}/`);if(!t.ok)throw new Error("Page not found");let i=await t.text(),r=i.match(/<body[^>]*>([\s\S]*)<\/body>/i),h=r?r[1]:i,b=g=>{let d=document.createElement("div");return d.textContent=g,d.innerHTML},f=dphelper?.sanitize?.html?dphelper.sanitize.html(h||""):b(h||"");a.innerHTML=f,window.scrollTo({top:0,behavior:"smooth"}),document.title=o.charAt(0).toUpperCase()+o.slice(1);let l=dphelper.path.rail();l&&l.length>0&&(a.className=a.className.replace(/path-\w+/g,"").trim(),a.classList.add(`path-${l[l.length-1]}`)),dphelper.navigation.ajax_running&&dphelper.navigation.ajax();}catch(t){console.error("Navigation error:",t);let i=window.location.origin;e.startsWith("/")&&!e.startsWith("//")&&!e.match(/^[a-zA-Z]:/)&&new URL(e,i).href.startsWith(i)&&(window.location.href=e);}},_bind:e=>{document.querySelectorAll(e).forEach(a=>{let o=a.getAttribute("href");if(!o||!o.startsWith("/")||o.includes("#"))return;let t=a.cloneNode(true);a.parentNode?.replaceChild(t,a),t.addEventListener("mouseup",i=>{let r=t.getAttribute("data-href")||o;history.pushState({href:r},"",r),dphelper.navigation.load(r),t.removeAttribute("href"),i.stopPropagation();});});},ajax:()=>{if(dphelper.navigation.ajax_running){dphelper.navigation._bind("a");return}dphelper.navigation.ajax_running=true,window.onpopstate=()=>dphelper.navigation.load(window.location.pathname),dphelper.navigation._bind("a"),globalThis.dp_hash_listener_set||(window.addEventListener("hashchange",()=>{let e=window.location.hash.substring(1);e&&document.getElementById(e)?.scrollIntoView({behavior:"smooth"});}),globalThis.dp_hash_listener_set=true);}};dphelper?.setDescription(y,j);var N=dphelper.navigation;
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 m={version:"4.6.2"};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:m.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,n,a)=>{Object.defineProperty(e,n.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[n.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(e,n)=>{Object.defineProperties(s,{[e.name]:{value:n,writable:false,configurable:false,enumerable:false}}),Object.keys(n).map(a=>(Object.defineProperties(s[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,e,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(e);}});var y={name:"navigation",active:true,subCommand:[{name:"ajax",version:"0.0.2",example:"dphelper.navigation.ajax()",author:"Dario Passariello",creationDate:"20260223",lastMod:"20260223",type:"function",active:true,description:"Vanilla AJAX Single Page Application (SPA) navigation engine.",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.navigation.load('/home')",author:"Dario Passariello",creationDate:"20260223",lastMod:"20260223",type:"function",active:true,description:"Loads a page via AJAX and injects it into the body.",env:"client",subCommand:[]}]},j={load:async e=>{let a=document.body,o=e.startsWith("/")?e.split("/")[1]||"home":e;if((!o||o==="")&&(o="home"),!document.querySelector(".loader")){let t=document.createElement("div");t.className="loader",t.innerHTML="<i></i>",t.style.opacity="0",t.style.transition="opacity 1000ms",a.appendChild(t),setTimeout(()=>t.style.opacity="1",10);}try{let t=await fetch(`${o}/`);if(!t.ok)throw new Error("Page not found");let i=await t.text(),r=i.match(/<body[^>]*>([\s\S]*)<\/body>/i),h=r?r[1]:i,b=g=>{let d=document.createElement("div");return d.textContent=g,d.innerHTML},f=dphelper?.sanitize?.html?dphelper.sanitize.html(h||""):b(h||"");a.innerHTML=f,window.scrollTo({top:0,behavior:"smooth"}),document.title=o.charAt(0).toUpperCase()+o.slice(1);let l=dphelper.path.rail();l&&l.length>0&&(a.className=a.className.replace(/path-\w+/g,"").trim(),a.classList.add(`path-${l[l.length-1]}`)),dphelper.navigation.ajax_running&&dphelper.navigation.ajax();}catch(t){console.error("Navigation error:",t);let i=window.location.origin;e.startsWith("/")&&!e.startsWith("//")&&!e.match(/^[a-zA-Z]:/)&&new URL(e,i).href.startsWith(i)&&(window.location.href=e);}},_bind:e=>{document.querySelectorAll(e).forEach(a=>{let o=a.getAttribute("href");if(!o||!o.startsWith("/")||o.includes("#"))return;let t=a.cloneNode(true);a.parentNode?.replaceChild(t,a),t.addEventListener("mouseup",i=>{let r=t.getAttribute("data-href")||o;history.pushState({href:r},"",r),dphelper.navigation.load(r),t.removeAttribute("href"),i.stopPropagation();});});},ajax:()=>{if(dphelper.navigation.ajax_running){dphelper.navigation._bind("a");return}dphelper.navigation.ajax_running=true,window.onpopstate=()=>dphelper.navigation.load(window.location.pathname),dphelper.navigation._bind("a"),globalThis.dp_hash_listener_set||(window.addEventListener("hashchange",()=>{let e=window.location.hash.substring(1);e&&document.getElementById(e)?.scrollIntoView({behavior:"smooth"});}),globalThis.dp_hash_listener_set=true);}};dphelper?.setDescription(y,j);var N=dphelper.navigation;
2
2
  export{N as navigation};
package/modules/net.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var i={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var n={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:n.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:(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(o,"setDescription",{value:(e,r)=>{Object.defineProperties(o,{[e.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(t=>(Object.defineProperties(o[e.name],{[t]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,e,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(e);}});var f={name:"net",active:true,subCommand:[{name:"smartFetch",version:"0.0.1",example:"dphelper.net.smartFetch(url, options)",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Fetch with automatic retry and exponential backoff",env:"both",subCommand:[]}]},p={smartFetch:async(e,r={},t=3,l=1e3)=>{try{let a=await fetch(e,r);if(!a.ok&&t>0)throw new Error(`HTTP ${a.status}: ${a.statusText}`);return a}catch(a){if(t===0)throw a;return console.warn(`[dphelper.net] Fetch failed, retrying in ${l}ms... (${t} retries left)`,a),await new Promise(c=>setTimeout(c,l)),p.smartFetch(e,r,t-1,l*2)}}};dphelper?.setDescription(f,p);var k=dphelper.net;exports.net=k;
1
+ 'use strict';var i={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var n={version:"4.6.2"};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:n.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:(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(o,"setDescription",{value:(e,r)=>{Object.defineProperties(o,{[e.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(t=>(Object.defineProperties(o[e.name],{[t]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,e,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(e);}});var f={name:"net",active:true,subCommand:[{name:"smartFetch",version:"0.0.1",example:"dphelper.net.smartFetch(url, options)",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Fetch with automatic retry and exponential backoff",env:"both",subCommand:[]}]},p={smartFetch:async(e,r={},t=3,l=1e3)=>{try{let a=await fetch(e,r);if(!a.ok&&t>0)throw new Error(`HTTP ${a.status}: ${a.statusText}`);return a}catch(a){if(t===0)throw a;return console.warn(`[dphelper.net] Fetch failed, retrying in ${l}ms... (${t} retries left)`,a),await new Promise(c=>setTimeout(c,l)),p.smartFetch(e,r,t-1,l*2)}}};dphelper?.setDescription(f,p);var k=dphelper.net;exports.net=k;