@benrogmans/lemma-engine 0.6.0 → 0.6.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 +9 -4
- package/lemma_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ Adds a Lemma document to the engine.
|
|
|
54
54
|
const result = engine.addLemmaCode(`
|
|
55
55
|
doc employee_contract
|
|
56
56
|
|
|
57
|
-
fact salary = 5000 eur
|
|
57
|
+
fact salary = 5000 eur
|
|
58
58
|
fact start_date = 2024-01-15
|
|
59
59
|
fact vacation_days = 25
|
|
60
60
|
|
|
@@ -148,11 +148,16 @@ async function calculatePricing() {
|
|
|
148
148
|
unless is_member then 10%
|
|
149
149
|
|
|
150
150
|
rule promo_discount = 0%
|
|
151
|
-
unless promo_code == "SAVE20" then 20%
|
|
152
151
|
unless promo_code == "SAVE10" then 10%
|
|
152
|
+
unless promo_code == "SAVE20" then 20%
|
|
153
153
|
|
|
154
|
-
rule best_discount =
|
|
155
|
-
|
|
154
|
+
rule best_discount = bulk_discount?
|
|
155
|
+
unless member_discount? >= bulk_discount? then member_discount?
|
|
156
|
+
unless promo_discount? >= bulk_discount? then promo_discount?
|
|
157
|
+
unless member_discount? >= promo_discount? then member_discount?
|
|
158
|
+
unless promo_discount? >= member_discount? then promo_discount?
|
|
159
|
+
|
|
160
|
+
rule final_price = base_price * quantity * (1 - best_discount?)
|
|
156
161
|
`;
|
|
157
162
|
|
|
158
163
|
// Load the document
|
package/lemma_bg.wasm
CHANGED
|
Binary file
|