eleva 1.0.0-rc.12 → 1.0.0-rc.13

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,4 +1,4 @@
1
- /*! Eleva Plugins v1.0.0-rc.12 | MIT License | https://elevajs.com */
1
+ /*! Eleva Plugins v1.0.0-rc.13 | MIT License | https://elevajs.com */
2
2
  'use strict';
3
3
 
4
4
  /**
@@ -1864,7 +1864,7 @@
1864
1864
  * @static
1865
1865
  * @param {Expression|unknown} expression - The expression to evaluate.
1866
1866
  * @param {TemplateData} data - The data context for evaluation.
1867
- * @returns {EvaluationResult} The result of the evaluation, or undefined if evaluation fails.
1867
+ * @returns {EvaluationResult} The result of the evaluation, or empty string if evaluation fails.
1868
1868
  *
1869
1869
  * @example
1870
1870
  * // Property access
@@ -1890,9 +1890,9 @@
1890
1890
  * // Result: "2024-01-01T00:00:00.000Z"
1891
1891
  *
1892
1892
  * @example
1893
- * // Failed evaluation returns undefined
1893
+ * // Failed evaluation returns empty string
1894
1894
  * TemplateEngine.evaluate("nonexistent.property", {});
1895
- * // Result: undefined
1895
+ * // Result: ""
1896
1896
  */ static evaluate(expression, data) {
1897
1897
  if (typeof expression !== "string") return expression;
1898
1898
  let fn = this._functionCache.get(expression);
@@ -1901,13 +1901,13 @@
1901
1901
  fn = new Function("data", `with(data) { return ${expression}; }`);
1902
1902
  this._functionCache.set(expression, fn);
1903
1903
  } catch {
1904
- return undefined;
1904
+ return "";
1905
1905
  }
1906
1906
  }
1907
1907
  try {
1908
1908
  return fn(data);
1909
1909
  } catch {
1910
- return undefined;
1910
+ return "";
1911
1911
  }
1912
1912
  }
1913
1913
  }