You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/History.html
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -178,6 +178,12 @@
178
178
179
179
180
180
181
+
<h1>0.4.1</h1>
182
+
<ul>
183
+
<li>Fixed issue with <code>CustomConstraint</code> not binding <code>this.assert</code> to <code>this</code>. <ahref="https://github.com/C2FO/nools/pull/146">#146</a> - <ahref="https://github.com/raymondfeng">@raymondfeng</a></li>
184
+
<li>Added more tests for custom constraints</li>
185
+
<li>Updated readme to include docs about custom constraints.</li>
186
+
</ul>
181
187
<h1>0.4.0</h1>
182
188
<ul>
183
189
<li>Fix for issue <ahref="https://github.com/C2FO/nools/issues/122">#122</a> referencing defined class within another defined class<ul>
Copy file name to clipboardExpand all lines: docs/index.html
+27Lines changed: 27 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -216,6 +216,7 @@ <h1>Usage</h1>
216
216
<li><ahref="#rule-salience">Salience</a></li>
217
217
<li><ahref="#rule-scope">Scope</a></li>
218
218
<li><ahref="#constraints">Constraints</a><ul>
219
+
<li><ahref="#custom-contraints">Custom</a></li>
219
220
<li><ahref="#not-constraint">Not</a></li>
220
221
<li><ahref="#or-constraint">Or</a></li>
221
222
<li><ahref="#from-constraint">From</a></li>
@@ -1098,6 +1099,32 @@ <h3>Constraints</h3>
1098
1099
<li><p>Reference(optional) - An object where the keys are properties on the current object, and values are aliases to use. The alias may be used in succeeding patterns.</p>
1099
1100
</li>
1100
1101
</ol>
1102
+
<p><aname="custom-contraints"></a></p>
1103
+
<h4>Custom Constraint</h4>
1104
+
<p>When declaring your rules progrmmatically you can also use a function as a constraint. The function will be called with an object containing each fact that has matched previous constraints.</p>
Copy file name to clipboardExpand all lines: history.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,9 @@
1
+
# 0.4.1
2
+
3
+
* Fixed issue with `CustomConstraint` not binding `this.assert` to `this`. [#146](https://github.com/C2FO/nools/pull/146) - [@raymondfeng](https://github.com/raymondfeng)
4
+
* Added more tests for custom constraints
5
+
* Updated readme to include docs about custom constraints.
6
+
1
7
# 0.4.0
2
8
3
9
* Fix for issue [#122](https://github.com/C2FO/nools/issues/122) referencing defined class within another defined class
Copy file name to clipboardExpand all lines: readme.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,7 @@ Or [download the source](https://raw.github.com/C2FO/nools/master/nools.js) ([mi
38
38
*[Salience](#rule-salience)
39
39
*[Scope](#rule-scope)
40
40
*[Constraints](#constraints)
41
+
*[Custom](#custom-contraints)
41
42
*[Not](#not-constraint)
42
43
*[Or](#or-constraint)
43
44
*[From](#from-constraint)
@@ -1161,6 +1162,39 @@ when {
1161
1162
1162
1163
4. Reference(optional) - An object where the keys are properties on the current object, and values are aliases to use. The alias may be used in succeeding patterns.
1163
1164
1165
+
<aname="custom-contraints"></a>
1166
+
1167
+
#### Custom Constraint
1168
+
1169
+
When declaring your rules progrmmatically you can also use a function as a constraint. The function will be called with an object containing each fact that has matched previous constraints.
1170
+
1171
+
1172
+
```javascript
1173
+
var HelloFact =declare({
1174
+
instance: {
1175
+
value:true,
1176
+
constructor:function (value) {
1177
+
this.value= value;
1178
+
}
1179
+
}
1180
+
});
1181
+
1182
+
var flow =nools.flow("custom contraint", function (flow) {
1183
+
flow.rule("hello rule", [HelloFact, "h", function (facts) {
0 commit comments