mirror of
https://github.com/material-components/material-web.git
synced 2026-03-09 00:09:23 +08:00
17 lines
489 B
SCSS
17 lines
489 B
SCSS
@use 'sass:meta';
|
|
|
|
///
|
|
/// is-type returns the given value if it matches the given type. If not, it
|
|
/// throws an error.
|
|
/// @param {*} $val - the value to check the type of.
|
|
/// @param {String} $type - the type we expect $val to be.
|
|
/// @return {*} returns $val assuming it is of type $type.
|
|
///
|
|
@function is-type($val, $type) {
|
|
$actual: meta.type-of($val);
|
|
@if $actual != $type {
|
|
@error 'expected "#{$val}" to be of type "#{$type}"; was type "#{$actual}"';
|
|
}
|
|
@return $val;
|
|
}
|