fig-tree-evaluator 2.3.1 → 2.3.2

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.
package/README.md CHANGED
@@ -1314,7 +1314,7 @@ e.g.
1314
1314
 
1315
1315
  ## Alias Nodes
1316
1316
 
1317
- If you have a node that is used more than once in a complex expression, it's possible to just evaluate the repeated node once, and refer to it throughout using an "alias" reference. This allows for a simpler expression (reduces duplication) as well as a performance improvement, since the aliased node is only evaluated once, providing a simple [memoization](https://en.wikipedia.org/wiki/Memoization) mechanism.
1317
+ If you have a node that is used more than once in a complex expression, it's possible to just evaluate the repeated node once, and refer to it throughout using an "alias" reference. This allows for a simpler expression (reduces code duplication) as well as a performance improvement, since the aliased node is only evaluated once, providing a simple [memoization](https://en.wikipedia.org/wiki/Memoization) mechanism. (See also [Caching/Memoization](#caching-memoization))
1318
1318
 
1319
1319
  For example, if you have the expression:
1320
1320
  ```js
@@ -1385,7 +1385,7 @@ Like all expression nodes, alias nodes can themselves contain complex expression
1385
1385
 
1386
1386
  ## Caching (Memoization)
1387
1387
 
1388
- FigTree Evaluator has basic memoization functionality for certain nodes to speed up re-evaluation of previously evaluated nodes. There is a single cache store per FigTree instance which persists for the lifetime of the instance. By default, it remembers the last 50 results, but this can be modified using the `maxCacheSize` option.
1388
+ FigTree Evaluator has basic [memoization](https://en.wikipedia.org/wiki/Memoization) functionality for certain nodes to speed up re-evaluation when the input parameters haven't changed. There is a single cache store per FigTree instance which persists for the lifetime of the instance. By default, it remembers the last 50 results, but this can be modified using the `maxCacheSize` option.
1389
1389
 
1390
1390
  Currently, caching is only implemented for the following operators, since they perform requests to external resources, which are inherently slow:
1391
1391
 
@@ -1395,6 +1395,10 @@ Currently, caching is only implemented for the following operators, since they p
1395
1395
  - GRAPH_QL (`useCache` default: `true`)
1396
1396
  - CUSTOM_FUNCTIONS (`useCache` default: `false`)
1397
1397
 
1398
+ This is different to the memoization provided by [Alias Nodes](#alias-nodes):
1399
+ - Alias nodes are still evaluated once for every evaluation -- they're more for re-use *within* a complex expression.
1400
+ - Cached nodes will persist *between* different evaluations as long as the input values are the same as a previously evaluated node.
1401
+
1398
1402
  ## More examples
1399
1403
 
1400
1404
  More examples, included large, complex expressions can be found within the test suites in the [repository](https://github.com/CarlosNZ/fig-tree-evaluator).
@@ -1427,7 +1431,7 @@ Please open an issue: https://github.com/CarlosNZ/fig-tree-evaluator/issues
1427
1431
 
1428
1432
  ## Changelog
1429
1433
 
1430
- - **v2.3.1**: Bug fix: alias nodes not working with `evaluateFullObject` (#72)
1434
+ - **v2.3.2**: Bug fix: alias nodes not working with `evaluateFullObject` (#72)
1431
1435
  - **v2.3.0**: Implement [caching/memoization](#caching-memoization) (#68)
1432
1436
  - **v2.2.3**: Change option `objects` name to `data` (but keep backward compatibility) (#66)
1433
1437
  - **v2.2.2**: Option to evaluate whole object if operator nodes are deep within it (#64)
package/build/cache.js CHANGED
@@ -59,7 +59,6 @@ var FigTreeCache = (function () {
59
59
  if (key in this.store) {
60
60
  this.queue = this.queue.filter(function (val) { return val !== key; });
61
61
  this.queue.unshift(key);
62
- console.log('Using cached result:', this.store[key]);
63
62
  return [2, this.store[key]];
64
63
  }
65
64
  return [4, action.apply(void 0, args)];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fig-tree-evaluator",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "Module to evaluate JSON-structured expression trees",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",