You are here

public static function SassScriptFunctions::abs in Sassy 7.3

Same name and namespace in other branches
  1. 7 phamlp/sass/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 value

SassNumber The absolute value of the number

Throws

SassScriptFunctionException If $number is not a number

File

phpsass/script/SassScriptFunctions.php, line 573

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);
}