aotrautils-srv 0.0.553 → 0.0.554
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 (
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (29/07/2023-00:04:13)»*/
|
|
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
|
|
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
|
|
1853
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
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
|
-
|
|
1866
|
-
|
|
1870
|
+
const sliced=attributeNameOrAttributesName.slice(1);
|
|
1871
|
+
let foundOrCreatedChild=getOrCreateAttribute(parentObject[attributeName], sliced);
|
|
1872
|
+
return foundOrCreatedChild;
|
|
1867
1873
|
}
|
|
1868
|
-
return
|
|
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 SERVER library associated with aotra version : «1_29072022-2359 (
|
|
4964
|
+
/*utils SERVER library associated with aotra version : «1_29072022-2359 (29/07/2023-00:04:13)»*/
|
|
4959
4965
|
/*-----------------------------------------------------------------------------*/
|
|
4960
4966
|
|
|
4961
4967
|
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.554",
|
|
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)",
|