aotrautils 0.0.1558 → 0.0.1560

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 (09/05/2025-16:18:56)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (10/05/2025-00:50:28)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4895,7 +4895,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4895
4895
 
4896
4896
 
4897
4897
 
4898
- /*utils CLIENT library associated with aotra version : «1_29072022-2359 (09/05/2025-16:18:56)»*/
4898
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (10/05/2025-00:50:28)»*/
4899
4899
  /*-----------------------------------------------------------------------------*/
4900
4900
  /* ## Utility global methods in a browser (htmljs) client environment.
4901
4901
  *
@@ -4972,8 +4972,7 @@ if(typeof monitorProgression === "undefined"){
4972
4972
  //)||null;
4973
4973
  //}
4974
4974
 
4975
- //...so we replace it with another function that is supposed to do the same
4976
- //thing :
4975
+ //...so we replace it with another function that is supposed to do the same thing :
4977
4976
  function getURLParameter(nameParam){
4978
4977
  var name=nameParam;
4979
4978
  if (name=new RegExp("[?&]" + encodeURIComponent(name) + "=([^&]*)").exec(location.search))
@@ -4982,6 +4981,37 @@ function getURLParameter(nameParam){
4982
4981
  }
4983
4982
 
4984
4983
 
4984
+ function arePathsSimilar(path1, path2, minLength=3){
4985
+ if(!path1 && !path2) return true;
4986
+ if(!path1 && path2) return false;
4987
+ if(path1 && !path2) return false;
4988
+
4989
+ const str1 = getLastConcreteSegment(path1.trim().toLowerCase());
4990
+ const str2 = getLastConcreteSegment(path2.trim().toLowerCase());
4991
+
4992
+ if(!str1 && !str2) return true;
4993
+ if(!str1 && str2) return false;
4994
+ if(str1 && !str2) return false;
4995
+
4996
+ for (let i = 0; i <= str1.length - minLength; i++) {
4997
+ for (let len = minLength; len <= str1.length - i; len++) {
4998
+ const sub = str1.substring(i, i + len);
4999
+ if (str2.includes(sub)) return true;
5000
+ }
5001
+ }
5002
+ return false;
5003
+ }
5004
+
5005
+ function getLastConcreteSegment(urlPath) {
5006
+ const segments = urlPath
5007
+ .split('/')
5008
+ .filter(s => s && !/^{.+}$/.test(s)); // ignore empty and placeholders
5009
+ return (0<segments.length ? segments[segments.length - 1] : null);
5010
+ }
5011
+
5012
+
5013
+
5014
+
4985
5015
 
4986
5016
 
4987
5017
  // A little method to help i18ning aotra user interface :
@@ -13467,7 +13497,7 @@ getAORTACClient=function(clientId=getUUID(), serverNodeOrigin="ws://127.0.0.1:40
13467
13497
 
13468
13498
 
13469
13499
 
13470
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (09/05/2025-16:18:56)»*/
13500
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (10/05/2025-00:50:28)»*/
13471
13501
  /*-----------------------------------------------------------------------------*/
13472
13502
 
13473
13503
 
@@ -14706,7 +14736,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
14706
14736
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14707
14737
 
14708
14738
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14709
- /*utils AI library associated with aotra version : «1_29072022-2359 (09/05/2025-16:18:56)»*/
14739
+ /*utils AI library associated with aotra version : «1_29072022-2359 (10/05/2025-00:50:28)»*/
14710
14740
  /*-----------------------------------------------------------------------------*/
14711
14741
 
14712
14742
 
@@ -14852,7 +14882,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
14852
14882
 
14853
14883
 
14854
14884
 
14855
- /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (09/05/2025-16:18:56)»*/
14885
+ /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (10/05/2025-00:50:28)»*/
14856
14886
  /*-----------------------------------------------------------------------------*/
14857
14887
 
14858
14888
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.1558",
3
+ "version": "0.0.1560",
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)",