Methods
compilePath(path)
Create a compacted fact name from a given fact name. Path do not end with a trailing '/'.
'../' Denote the parent term. Move up one term in the context or path.
'./' Denote the current term. Removed from the context or path.
Examples:
'/a/given/../correct/./path' is compiled to '/a/correct/path'
Parameters:
Name | Type | Description |
---|---|---|
path |
String | The path or context to compile into a context. |
- Source:
equals(a, b)
Compare two values and return true if they are equal. Fix date comparison issue and insure
both types are the same.
Parameters:
Name | Type | Description |
---|---|---|
a |
* | The first value used to compare. |
b |
* | The second value used to caompare. |
- Source:
getContext(compiledPath)
Extracts the context from the fact or rule name. Must be a compiled path, not a path that
contains "../" or "./".
Parameters:
Name | Type | Description |
---|---|---|
compiledPath |
String | The compiled path to extract the context from. |
- Source:
Example
Given the rule path: '/path/to/some/rule'
The returned value would be: '/path/to/some'
(generator) parseFactPaths(rule)
Generator that parses all fact paths derived from the given rule parameters. Either return the
parameter name or the path contained by the optional attribute comment. Single parameter lambda
function must put the parameter between parenthesis to be parsed properly.
Parameters:
Name | Type | Description |
---|---|---|
rule |
AsyncFunction | The rule |
- Source:
Example
Using an attribute comment:
async function(/¤@ /path/to/fact ¤/ param1, param2) {}
In the above example:
1) ¤ replaces * because using * and / one after the other ends the documentation comment.
2) returned fact paths would be ['/path/to/fact', 'param2']