mirror of
https://github.com/material-components/material-web.git
synced 2024-09-21 02:27:12 +03:00
6c2aef6901
PiperOrigin-RevId: 509583504
24 lines
610 B
SCSS
24 lines
610 B
SCSS
//
|
|
// Copyright 2022 Google LLC
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
// go/keep-sorted start
|
|
@use 'sass:meta';
|
|
// go/keep-sorted end
|
|
|
|
///
|
|
/// 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;
|
|
}
|