material-web/sass/_assert.scss
Elizabeth Mitchell 6c2aef6901 chore(all): add keep-sorted comments to Sass imports
PiperOrigin-RevId: 509583504
2023-02-14 11:10:23 -08:00

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