mevento 2.0.1 → 2.0.3

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.
@@ -1746,8 +1746,11 @@ class MEvento extends NodeVisitor {
1746
1746
  unregisterFunction(id) {
1747
1747
  delete this._functionsRegistry[id];
1748
1748
  }
1749
- execute(source, cache = true) {
1749
+ execute(source, cache = true, input) {
1750
1750
  const module = MEvento.compile(source, cache);
1751
+ if (input) {
1752
+ Object.keys(input).forEach(k => this.changeVariable(k, input[k]));
1753
+ }
1751
1754
  return this.visit(module);
1752
1755
  }
1753
1756
  static compile(source, cache = false) {
@@ -1768,9 +1771,12 @@ class MEvento extends NodeVisitor {
1768
1771
  static unregister(id) {
1769
1772
  delete MEvento._globalFunctionsRegistry[id];
1770
1773
  }
1771
- static run(source, cache = false) {
1774
+ static run(source, cache = false, input) {
1772
1775
  const mevento = new MEvento();
1773
1776
  const module = MEvento.compile(source, cache);
1777
+ if (input) {
1778
+ Object.keys(input).forEach(k => mevento.changeVariable(k, input[k]));
1779
+ }
1774
1780
  return mevento.visit(module);
1775
1781
  }
1776
1782
  static newInstance() {
@@ -2129,13 +2135,19 @@ class MEventoAsync extends MEvento {
2129
2135
  unregisterFunction(id) {
2130
2136
  delete this._functionsRegistry[id];
2131
2137
  }
2132
- async execute(source, cache = true) {
2138
+ async execute(source, cache = true, input) {
2133
2139
  const module = MEvento.compile(source, cache);
2140
+ if (input) {
2141
+ Object.keys(input).forEach(k => this.changeVariable(k, input[k]));
2142
+ }
2134
2143
  return await this.visit(module);
2135
2144
  }
2136
- static async run(source, cache = false) {
2145
+ static async run(source, cache = false, input) {
2137
2146
  const mevento = new MEventoAsync();
2138
2147
  const module = MEvento.compile(source, cache);
2148
+ if (input) {
2149
+ Object.keys(input).forEach(k => mevento.changeVariable(k, input[k]));
2150
+ }
2139
2151
  return await mevento.visit(module);
2140
2152
  }
2141
2153
  static newInstance() {