aotrautils 0.0.557 → 0.0.558

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 (26/07/2023-23:56:25)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (29/07/2023-00:04:01)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -1843,29 +1843,35 @@ window.nothing=function(nullable, insist=false){
1843
1843
  return false;
1844
1844
  }
1845
1845
 
1846
- window.getOrCreateAttribute=function(parentObject, attributeNameOrAttributesName, defaultValue={}){
1846
+ window.getOrCreateAttribute=function(parentObject, attributeNameOrAttributesName){
1847
1847
  if(nothing(parentObject)) return null;
1848
1848
  if(nothing(attributeNameOrAttributesName)) return parentObject;
1849
1849
  if(isString(attributeNameOrAttributesName) || (isArray(attributeNameOrAttributesName) && attributeNameOrAttributesName.length===1)){
1850
1850
  const attributeName=(isArray(attributeNameOrAttributesName) && attributeNameOrAttributesName.length===1)?
1851
1851
  attributeNameOrAttributesName[0]:attributeNameOrAttributesName;
1852
- if(parentObject[attributeName]==null && defaultValue!=null){
1853
- parentObject[attributeName]=defaultValue;
1852
+ if(parentObject[attributeName]==null){
1853
+ // parentObject[attributeName]=defaultValue;
1854
+ // CAUTION : if we have defaultValue as parameter, sometimes because of the recursive call, it can refer to a persisting object ! Thus, creating a strange bug.
1855
+ const DEFAULT_VALUE={};
1856
+ parentObject[attributeName]=DEFAULT_VALUE;
1854
1857
  }
1855
- return parentObject[attributeName];
1858
+ let foundOrCreatedChild=parentObject[attributeName];
1859
+ return foundOrCreatedChild;
1856
1860
  }
1857
1861
  if(isArray(attributeNameOrAttributesName)){
1858
-
1862
+
1859
1863
  const attributeName=attributeNameOrAttributesName[0];
1860
- if(parentObject[attributeName]){
1861
- parentObject[attributeName]=getOrCreateAttribute(parentObject[attributeName], attributeNameOrAttributesName.slice(1), defaultValue);
1862
- }else{
1863
- parentObject[attributeName]=getOrCreateAttribute({}, attributeNameOrAttributesName.slice(1), defaultValue);
1864
+ if(parentObject[attributeName]==null){
1865
+ // parentObject[attributeName]=defaultValue;
1866
+ // CAUTION : if we have defaultValue as parameter, sometimes because of the recursive call, it can refer to a persisting object ! Thus, creating a strange bug.
1867
+ const DEFAULT_VALUE={};
1868
+ parentObject[attributeName]=DEFAULT_VALUE;
1864
1869
  }
1865
- return parentObject;
1866
-
1870
+ const sliced=attributeNameOrAttributesName.slice(1);
1871
+ let foundOrCreatedChild=getOrCreateAttribute(parentObject[attributeName], sliced);
1872
+ return foundOrCreatedChild;
1867
1873
  }
1868
- return parentObject;
1874
+ return null; // (case no child found nor could be created.)
1869
1875
  }
1870
1876
 
1871
1877
  window.nonull=function(value,defaultValue){
@@ -4955,7 +4961,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4955
4961
 
4956
4962
 
4957
4963
 
4958
- /*utils CLIENT library associated with aotra version : «1_29072022-2359 (26/07/2023-23:56:25)»*/
4964
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (29/07/2023-00:04:01)»*/
4959
4965
  /*-----------------------------------------------------------------------------*/
4960
4966
  /* ## Utility global methods in a browser (htmljs) client environment.
4961
4967
  *
@@ -13222,7 +13228,7 @@ createOritaMicroClient=function(url, port, isNode=false, staticMicroClientIdPara
13222
13228
 
13223
13229
 
13224
13230
 
13225
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (26/07/2023-23:56:25)»*/
13231
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (29/07/2023-00:04:01)»*/
13226
13232
  /*-----------------------------------------------------------------------------*/
13227
13233
 
13228
13234
 
@@ -14461,7 +14467,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
14461
14467
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14462
14468
 
14463
14469
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14464
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (26/07/2023-23:56:25)»*/
14470
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (29/07/2023-00:04:01)»*/
14465
14471
  /*-----------------------------------------------------------------------------*/
14466
14472
 
14467
14473
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.557",
3
+ "version": "0.0.558",
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)",