From 0bfab96fc0b385583db26ab255886ef2b4259c55 Mon Sep 17 00:00:00 2001 From: Adam Hollett Date: Tue, 5 Apr 2016 09:31:44 -0400 Subject: [PATCH] Add abs filter docs --- filters/abs.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 filters/abs.md 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 +```