@accordproject/template-engine 2.7.1 → 2.8.0
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 +2 -2
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -1
- package/dist/index.mjs.map +1 -1
- package/dist/worker.js.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -125,9 +125,9 @@ TemplateMark JSON is a well-defined file format, meaning that powerful template
|
|
|
125
125
|
|
|
126
126
|
We encourage community and commercial innovation in this area!
|
|
127
127
|
|
|
128
|
-
### 3. Logic
|
|
128
|
+
### 3. Full Logic Support
|
|
129
129
|
|
|
130
|
-
Unlike some templating systems which prohibit, or
|
|
130
|
+
Unlike some templating systems which prohibit, or minimize, logic in templates, Accord Project templates fully embrace templates that may contain sophisticated logic: conditional logic to determine what text to include, or even calculations, for example to calculate the monthly payments for a mortgage based on the term of the mortgage, the amount and the interest rate.
|
|
131
131
|
|
|
132
132
|
### 4. Type-safety
|
|
133
133
|
|
package/dist/index.js
CHANGED
|
@@ -910,7 +910,12 @@ async function generateAgreement(modelManager, clauseLibrary, templateMark, data
|
|
|
910
910
|
delete context.dependencies;
|
|
911
911
|
delete context.functionName;
|
|
912
912
|
} else if (CLAUSE_DEFINITION_RE.test(nodeClass)) {
|
|
913
|
-
|
|
913
|
+
const path = getJsonPath(templateMark, context, this.path);
|
|
914
|
+
const variableValues = jp.query(data, path, 1);
|
|
915
|
+
if (context.name !== "top" && (variableValues.length === 0 || variableValues[0] === void 0 || variableValues[0] === null)) {
|
|
916
|
+
delete context.nodes;
|
|
917
|
+
stopHere = true;
|
|
918
|
+
} else if (context.condition) {
|
|
914
919
|
checkCode(context.condition);
|
|
915
920
|
const result = !!userCodeResults[this.path.join("/")];
|
|
916
921
|
if (!result) {
|