From b0a675ab1406513d99a6ace09dde992815f4513a Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Wed, 21 Sep 2016 16:32:27 -0700 Subject: [PATCH] Add percentage(). --- lib/src/functions.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/src/functions.dart b/lib/src/functions.dart index dd74f541..f323e106 100644 --- a/lib/src/functions.dart +++ b/lib/src/functions.dart @@ -479,6 +479,15 @@ void defineCoreFunctions(Environment environment) { return new SassString(string.text.toLowerCase(), quotes: string.hasQuotes); })); + // ## Number + + environment + .setFunction(new BuiltInCallable("percentage", r"$number", (arguments) { + var number = arguments[0].assertNumber("number"); + number.assertNoUnits(); + return new SassNumber(number.value * 100, '%'); + })); + // ## Introspection environment.setFunction(new BuiltInCallable("inspect", r"$value",