Skip to content

Instantly share code, notes, and snippets.

@KittyGiraudel
Last active November 22, 2016 11:19
Show Gist options
  • Save KittyGiraudel/2933ef053ae0bf70ad8b to your computer and use it in GitHub Desktop.
Save KittyGiraudel/2933ef053ae0bf70ad8b to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.9)
// Compass (v1.0.1)
// ----
@function is-number($value) {
@return type-of($value) == 'number';
}
@function is-time($value) {
@return is-number($value) and index('ms' 's', unit($value)) != null;
}
@function is-duration($value) {
@return is-time($value);
}
@function is-angle($value) {
@return is-number($value) and index('deg' 'rad' 'grad' 'turn', unit($value)) != null;
}
@function is-frequency($value) {
@return is-number($value) and index('Hz' 'kHz', unit($value)) != null;
}
@function is-integer($value) {
@return is-number($value) and round($value) == $value;
}
@function is-relative-length($value) {
@return is-number($value) and index('em' 'ex' 'ch' 'rem' 'vw' 'vh' 'vmin' 'vmax', unit($value)) != null;
}
@function is-absolute-length($value) {
@return is-number($value) and index('cm' 'mm' 'in' 'px' 'pt' 'pc', unit($value)) != null;
}
@function is-percentage($value) {
@return is-number($value) and unit($value) == '%';
}
@function is-length($value) {
@return is-relative-length($value) or is-absolute-length($value);
}
@function is-resolution($value) {
@return is-number($value) and index('dpi' 'dpcm' 'dppx', unit($value)) != null;
}
@function is-position($value) {
@return is-length($value) or is-percentage($value) or index('top' 'right' 'bottom' 'left' 'center', $value) != null;
}
@gil00pita
Copy link

gil00pita commented Aug 3, 2016

Sorry but the function is-percentage doesn't work for me, I am using gulp-sass not Grunt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment