diff --git a/filters/abs.md b/filters/abs.md new file mode 100644 index 0000000..af0d003 --- /dev/null +++ b/filters/abs.md @@ -0,0 +1,37 @@ +--- +title: abs +--- + +Returns the absolute value of a number. + +```liquid +{% raw %} +{{ -17 | abs }} +{% endraw %} +``` + +```text +17 +``` + +```liquid +{% raw %} +{{ 4 | abs }} +{% endraw %} +``` + +```text +4 +``` + +`abs` will work on a string if the string only contains a number. + +```liquid +{% raw %} +{{ "-19.86" | abs }} +{% endraw %} +``` + +```text +19.86 +```