You are here

public static function SassScriptFunctions::abs in Sassy 7

Same name and namespace in other branches
  1. 7.3 phpsass/script/SassScriptFunctions.php \SassScriptFunctions::abs()

* Finds the absolute value of a number. * For example: * abs(10px) => 10px * abs(-10px) => 10px * *

Parameters

SassNumber The number to round: * @return SassNumber The absolute value of the number * @throws SassScriptFunctionException If $number is not a number

File

phamlp/sass/script/SassScriptFunctions.php, line 566

Class

SassScriptFunctions
SassScript functions class. A collection of functions for use in SassSCript. @package PHamlP @subpackage Sass.script

Code

public static function abs($number) {
  SassLiteral::assertType($number, 'SassNumber');
  return new SassNumber(abs($number->value) . $number->units);
}