helpers

functions

strip-units

@function strip-units($var) { ... }
View source

Description

Get unitless value of $var.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$varnoneMeasurenone

Returns

Number

Example

strip-units(100px) // 100
strip-units(18em)  // 18

Used by

General

functions

is-bool

@function is-bool($var) { ... }
View source

Description

Tests whether $var is bool.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$var

possible bool type variable

Anynone

Returns

Bool

Example

is-bool(true)     //returns true
is-bool(false)    //returns true
is-bool(test)     //returns false
is-bool(1)        //returns false
is-bool(null)     //returns false

is-color

@function is-color($var) { ... }
View source

Description

Tests whether $var is color.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$var

possible color type variable

Anynone

Returns

Bool

Example

is-color(#333)     //returns true
is-color(black)    //returns true
is-color(test)     //returns false

is-empty

@function is-empty($var) { ... }
View source

Description

Tests whether $var is empty.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$var

possible empty variable

Anynone

Returns

Bool

Example

is-empty('')        //returns true
is-empty(())        //returns true
is-empty('test')    //returns false

is-float

@function is-float($var) { ... }
View source

Description

Tests whether $var is float.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$var

possible float number type variable

Anynone

Returns

Bool

Example

is-float(-1.5)	//returns true
is-float(1.5)     //returns true
is-float(1)		//returns false
is-float(1em) 	//returns false
is-float(0) 	    //returns false

Requires

is-integer

@function is-integer($var) { ... }
View source

Description

Tests whether $var is integer.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$var

possible integer type variable

Anynone

Returns

Bool

Example

is-integer(1)		 //returns true
is-integer(0)		 //returns true
is-integer(-50)    //returns true
is-integer(1.5)	 //returns false
is-integer(1em)	 //returns false

Requires

Used by

is-list

@function is-list($var) { ... }
View source

Description

Tests whether $var is list.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$var

possible list type variable

Anynone

Returns

Bool

Example

is-list(a b)             //returns true
is-list(1 2 3)           //returns true
is-list((test, test))	   //returns true
is-list(test)            //returns false
is-list(1)               //returns false

is-map

@function is-map($var) { ... }
View source

Description

Tests whether $var is map.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$var

possible map type variable

Anynone

Returns

Bool

Example

is-map(a: 1, b: 2)   	  //returns true
is-map(1 2 3)        	  //returns false
is-map((test, test))    //returns false
is-map(test)         	  //returns false
is-map(1)            	  //returns false

is-measure-negative

@function is-measure-negative($var) { ... }
View source

Description

Tests whether $var is a negative measure.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$var

possible negative measure type variable

Anynone

Returns

Bool

Example

is-measure-negative(-10em)   	 //returns true
is-measure-negative(0px)     	 //returns false
is-measure-negative(0)       	 //returns false
is-measure-negative(777rem)    //returns false

Requires

is-measure-positive

@function is-measure-positive($var) { ... }
View source

Description

Tests whether $var is a positive measure.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$var

possible positive measure type variable

Anynone

Returns

Bool

Example

is-measure-positive(10px)   	 //returns true
is-measure-positive(0px)   	 //returns false
is-measure-positive(0)   		 //returns false
is-measure-positive(-777px)    //returns false

Requires

is-measure

@function is-measure($var) { ... }
View source

Description

Tests whether $var is measure.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$var

possible measure type variable

Anynone

Returns

Bool

Example

is-measure(1px) 	  //returns true
is-measure(5em)     //returns true
is-measure(5)       //returns false
is-measure(test)    //returns false
is-measure(em)      //returns false

Requires

Used by

is-negative

@function is-negative($value) { ... }
View source

Description

Tests whether $var is negative.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$value

possible negative type variable

Anynone

Returns

Bool

Example

is-negative(-5)        //returns true
is-negative(-10px)     //returns false
is-negative(300)       //returns false
is-negative('test')    //returns false
is-negative(0)         //returns false

Requires

Used by

is-null

@function is-null($var) { ... }
View source

Description

Tests whether $var is bool.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$var

possible null type variable

Anynone

Returns

Bool

Example

is-null(null)    	  //returns true
is-null(false)   	  //returns false
is-null(0)       	  //returns false
is-null('hello')    //returns false
is-null(113)        //returns false

is-number

@function is-number($var) { ... }
View source

Description

Tests whether $var is number.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$var

possible number type variable

Anynone

Returns

Bool

Example

is-number(1)   				   //returns true
is-number('1') 	               //returns false
is-number(1em)    			   //returns false
is-number('sassy-validation')    //returns false

Used by

is-positive

@function is-positive($var) { ... }
View source

Description

Tests whether $var is positive.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$var

possible positive type variable

Anynone

Returns

Bool

Example

is-positive(1)          //returns true
is-positive(0)          //returns false
is-positive(-1)    	  //returns false
is-positive('hello')    //returns false

Requires

Used by

is-string

@function is-string($var) { ... }
View source

Description

Tests whether $var is string.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$var

possible string type variable

Anynone

Returns

Bool

Example

is-string('sassy-validation')    //returns true
is-string(1)    	 			   //returns false
is-string(18px)    	 		   //returns false

is-unit

@function is-unit($value) { ... }
View source

Description

Tests whether $var is unit.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$value

possible unit type variable

Anynone

Returns

Bool

Example

is-unit(rem)    			     //returns true
is-unit(-1000px) 	   			 //returns false
is-unit('sassy-validation')    //returns false
is-unit(777) 		   			 //returns false

Requires

validate

@function validate($var, $validations) { ... }
View source

Description

Validates input against various tests

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$var

a variable to be tested

Anynone
$validations

list of validation tests to run against $var

Bool or Color or Empty or Float or Integer or List or Map or Measure-negative or Measure-positive or Measure or Negative or Positive or Null or Number or String or Unitnone

Returns

Bool

Example

validate(1em, measure)     		// returns true
validate(100, number positive)    // returns true
validate(1, number)        	    // returns true
validate(1, string)        	    // returns false

Throws

  • {$validation} is not a known validation type.

variables

sv-units

$sv-units: ('px', 'cm', 'mm', '%', 'ch', 'pc', 'in', 'em', 'rem', 'pt', 'pc', 'ex', 'vw', 'vh', 'vmin', 'vmax');
View source

Description

List of all possible unit types

Type

List

Used by