aotrautils 0.0.1668 → 0.0.1670

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 (01/06/2025-02:10:08)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (01/06/2025-03:38:11)»*/
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){
@@ -4897,8 +4932,9 @@ window.parseJSON=function(strParam){
4897
4932
  var obj=eval("(" + str + ")");
4898
4933
  return obj;
4899
4934
  } catch (error2){
4935
+ // !!! SILENT ERROR !!!
4900
4936
  // TRACE
4901
- log(error2);
4937
+ // log(error2);
4902
4938
  throw new Error("ERROR : Error parsing string «" + strParam + "» as JSON. Last-chance fallback failed." +
4903
4939
  " CHECK IF THERE IS ANY «'» SINGLE QUOTE CHARACTER IN YOUR LITERALS STRINGS, AND REPLACE IT WITH «´» ACUTE CHARACTER INSTEAD.");
4904
4940
  }
@@ -4952,7 +4988,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4952
4988
 
4953
4989
 
4954
4990
 
4955
- /*utils CLIENT library associated with aotra version : «1_29072022-2359 (01/06/2025-02:10:08)»*/
4991
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (01/06/2025-03:38:11)»*/
4956
4992
  /*-----------------------------------------------------------------------------*/
4957
4993
  /* ## Utility global methods in a browser (htmljs) client environment.
4958
4994
  *
@@ -13555,7 +13591,7 @@ getAORTACClient=function(clientId=getUUID(), serverNodeOrigin="ws://127.0.0.1:40
13555
13591
 
13556
13592
 
13557
13593
 
13558
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (01/06/2025-02:10:08)»*/
13594
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (01/06/2025-03:38:11)»*/
13559
13595
  /*-----------------------------------------------------------------------------*/
13560
13596
 
13561
13597
 
@@ -14794,7 +14830,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
14794
14830
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14795
14831
 
14796
14832
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14797
- /*utils AI library associated with aotra version : «1_29072022-2359 (01/06/2025-02:10:08)»*/
14833
+ /*utils AI library associated with aotra version : «1_29072022-2359 (01/06/2025-03:38:11)»*/
14798
14834
  /*-----------------------------------------------------------------------------*/
14799
14835
 
14800
14836
 
@@ -14940,7 +14976,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
14940
14976
 
14941
14977
 
14942
14978
 
14943
- /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (01/06/2025-02:10:08)»*/
14979
+ /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (01/06/2025-03:38:11)»*/
14944
14980
  /*-----------------------------------------------------------------------------*/
14945
14981
 
14946
14982
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.1668",
3
+ "version": "0.0.1670",
4
4
  "main": "aotrautils.build.js",
5
5
  "description": "A library for vanilla javascript utils (client-side) used in aotra javascript CMS",
6
6
  "author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",