Sass type-of() Function

Last Updated:

Sass type-of() Function

The type-of() function returns the type of $value.

Example

SASS TO CSS CONVERTER
// Check your console $font-weights: ("regular": 400, "medium": 500, "bold": 700); @function foo($x) { @return $x; } @mixin syntax-colors($args...) { @debug type-of($args); } @debug type-of(10px); // number @debug type-of("#8c8c8c"); // string @debug type-of(#8c8c8c); // color @debug type-of(true); // bool @debug type-of(null); // null @debug type-of(10px 20px 30px); // list @debug type-of($font-weights); // map @debug type-of(get-function(foo)); // function@include syntax-colors( $string: #080, // arglist $comment: #800, )

Syntax

type-of($value)

Parameter Value

ValueTypeExplanation
$value Required Specifies a value for which the type needs to be found.

Return Value

ValueExplanation
value Returns the type of $value. The following are the list of possible values.
  • number
  • string
  • color
  • bool
  • null
  • list
  • map
  • function
  • arglist

Share this Page

Meet the Author