aotrautils-srv 0.0.1667 → 0.0.1669

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.
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- /*utils COMMONS library associated with aotra version : «1_29072022-2359 (28/05/2025-02:26:50)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (01/06/2025-03:25:26)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -3923,8 +3923,43 @@ var Timer=function(callback, delay){
3923
3923
 
3924
3924
 
3925
3925
 
3926
-
3927
3926
  //=================================================================================
3927
+ // OBJECTS MANAGEMENT
3928
+
3929
+
3930
+ // (for arrays, it's index between dots !)
3931
+ window.getByDottedPath=(obj, path)=>{
3932
+ if(!contains(path,".")){
3933
+ return obj[path];
3934
+ }
3935
+ let result=obj;
3936
+ const parts=path.split(".");
3937
+ for(const part of parts) {
3938
+ if(result==null)
3939
+ return undefined;
3940
+ result=result[part];
3941
+ }
3942
+ return result;
3943
+ };
3944
+
3945
+ // (for arrays, it's index between dots !)
3946
+ window.setByDottedPath=(obj, path, value)=>{
3947
+ if(!contains(path,".")){
3948
+ obj[path]=vale;
3949
+ }
3950
+ let currentObject=obj;
3951
+ const parts=path.split(".");
3952
+ for(let i=0; i<parts.length-1; i++) {
3953
+ const part=parts[i];
3954
+ if(!(part in currentObject)) {
3955
+ const nextIsIndex=(!isNaN(parts[i + 1]));
3956
+ currentObject[part]=(nextIsIndex ? [] : {});
3957
+ }
3958
+ currentObject=currentObject[part];
3959
+ }
3960
+ currentObject[parts[parts.length - 1]]=value;
3961
+ };
3962
+
3928
3963
 
3929
3964
 
3930
3965
  getUUID=function(mode=null){
@@ -4952,7 +4987,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4952
4987
 
4953
4988
 
4954
4989
 
4955
- /*utils AI library associated with aotra version : «1_29072022-2359 (28/05/2025-02:26:50)»*/
4990
+ /*utils AI library associated with aotra version : «1_29072022-2359 (01/06/2025-03:25:26)»*/
4956
4991
  /*-----------------------------------------------------------------------------*/
4957
4992
 
4958
4993
 
@@ -5098,7 +5133,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
5098
5133
 
5099
5134
 
5100
5135
 
5101
- /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (28/05/2025-02:26:50)»*/
5136
+ /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (01/06/2025-03:25:26)»*/
5102
5137
  /*-----------------------------------------------------------------------------*/
5103
5138
 
5104
5139
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.1667",
3
+ "version": "0.0.1669",
4
4
  "main": "aotrautils-srv.build.js",
5
5
  "description": "A library for vanilla javascript utils (server-side) used in aotra javascript CMS",
6
6
  "author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",