Is there something like is-map($some_variable)
in SASS?
I have tried looking into the documentation but there is none there.
Maps in Sass hold pairs of keys and values, and make it easy to look up a value by its corresponding key. They're written (<expression>: <expression>, <expression>: <expression>) . The expression before the : is the key, and the expression after is the value associated with that key.
The basic syntax for defining a variable is simple: Just use a $ before the variable name and treat its definition like a CSS rule: Sass Variable Syntax: $<variable name>:<value>; The following declares a variable named large-font.
map-keys($map) function: This function returns the list of the keys in the given map.
SASS supports two syntaxes namely SCSS and Indented syntax. The SCSS (Sassy CSS) is an extension of CSS syntax. This means every valid CSS is a valid SCSS as well. SCSS makes much easier to maintain large stylesheets and can recognize vendor specific syntax, Many CSS and SCSS files use the extension .
You can implement it with the type-of
function, like this one:
@function is-map($var){
@return type-of($var) == 'map';
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With