Clamp a discount
FreeLogic@rabbinatix/clamp-a-discount by Rabbinatixupdated Oct 4, 2026
Keeps a discount between 0 % and 50 %.
Protects checkout from negative or runaway discounts: Maximum with 0 sets the floor, Minimum with 50 the ceiling. Change the 50 on the Minimum node to your own limit.
Shows: Maximum, Minimum.
How to use it
Add it to your logic, then add a Call Function step in any logic and pick Clamp a discount. It belongs to no system, so every system can use it. Or download the TypeScript and call it from your own code.
Inputs
percent: Number
Outputs
percent: Number
Previewdrag the steps around; scroll to zoom
Function Entry, Input / output. 0 inputs, 2 outputs. step 1 of 4
Clamp a discount
percent
Maximum, Math. 2 inputs, 1 output. step 2 of 4
Maximum
a
b
result
Minimum, Math. 2 inputs, 1 output. step 3 of 4
Minimum
a
b
result
Return, Input / output. 2 inputs, 0 outputs. step 4 of 4
Return
percent
Arrow keys: next or previous step in flow order. Alt with arrows: nearest step in that direction. Enter: open. Shift F10: more actions.
Examplesrun live against the logic · 3/3 pass
| Passed | Example | Input | Output |
|---|---|---|---|
| Too high | {"percent":70} | {"percent":50} | |
| Negative | {"percent":-5} | {"percent":0} | |
| Within limits | {"percent":15} | {"percent":15} |
Try it
Versions
In this package
Clamp a discount (entry)
