General

functions

sf-assert-callable

@function sf-assert-callable($value) { ... }

Description

Check if a given value is callable and throw the appropriate error otherwise

Parameters

parameter Nameparameter Descriptionparameter Typeparameter Default value
$value

Value to check

Any none

Returns

Boolean

Requires

Used by

sf-assert-function

@function sf-assert-function($value) { ... }

Description

Check if a given value is a function and throw an error otherwise

Parameters

parameter Nameparameter Descriptionparameter Typeparameter Default value
$value

Value to check

Any none

Returns

Boolean

Requires

sf-call

@function sf-call($func, $args......) { ... }

Description

Polyfill for the call function supporting both functions and strings.

Parameters

parameter Nameparameter Descriptionparameter Typeparameter Default value
$func

Function or name of the function to call

Function or String none
$args...

Arguments to call the function with

Arglist none

Returns

Any type

Requires

sf-get-function

@function sf-get-function($-) { ... }

Description

Return a reference to the given function or function name string compatible with the current Sass version.

  • For Sass < 3.5, return the passed argument
  • For Sass >= 3.5, return a first-class function if a function name string was passed

Parameters

parameter Nameparameter Descriptionparameter Typeparameter Default value
$-

$func - Function or name of the function

Function or String none

Returns

Function or String

Function or name of the function following the support of first-class functions.

Requires

Used by

sf-is-callable

@function sf-is-callable($value) { ... }

Description

Return if a given value is callable.

Parameters

parameter Nameparameter Descriptionparameter Typeparameter Default value
$value

Value to test

Any none

Returns

Boolean

Used by

sf-is-function

@function sf-is-function($value) { ... }

Description

Return if a given value is a function or a function name string.

Parameters

parameter Nameparameter Descriptionparameter Typeparameter Default value
$value

Value to test

Any none

Returns

Boolean

Used by

[private] _sf-error-message

@function _sf-error-message($message, $search...) { ... }

Description

Returns a properly formatted error message with

  • A prefix (see $sf-error-prefix)
  • $message with its substitutions

Parameters

parameter Nameparameter Descriptionparameter Typeparameter Default value
$message

Error message

String none
$search

Substitutes for the error message

Arglist none

Returns

String

Formatted message

Requires

Used by

[private] _sf-str-replace

@function _sf-str-replace($string, $search, $replace) { ... }

Description

Replace $search with $replace in $string. From https://github.com/HugoGiraudel/SassyStrings

Parameters

parameter Nameparameter Descriptionparameter Typeparameter Default value
$string

Initial string

String none
$search

Substring to replace

String none
$replace

("") - New value

String none

Returns

String

Updated string

Used by

[private] _sf-str-substitute

@function _sf-str-substitute($string, $substitutes...) { ... }

Description

Replace in $string each keyword formatted like $<index> with the substitute of the corresponding index.

Replace "$1" with the first substitute passed, "$2" with the second, and so on...

Parameters

parameter Nameparameter Descriptionparameter Typeparameter Default value
$string

Initial string

String none
$substitutes

List of string used as substitutes

Arglist none

Returns

String

Updated string

Requires

Used by

variables

sf-error-prefix

$sf-error-prefix: 'Assertion Error: ' !default;

Description

Prefix for all the error messages

Type

String

Used by

sf-error-function-invalid

$sf-error-function-invalid: '$1 ($2) is not a function.' !default;

Description

Error message for when a function name or reference is expected but an other value is received.

Type

String

Used by

sf-error-function-reference-invalid

$sf-error-function-reference-invalid: '$1 ($2) is not a function.' !default;

Description

Error message for when a first-class function reference is expected but an other value is received.

Type

String

Used by

sf-error-function-not-found

$sf-error-function-not-found: 'function name string "$1" cannot be found.' !default;

Description

Error message for when a function name cannot be found and the get-function function is not availaible (Sass < 3.5).

Type

String

Used by

sf-error-function-not-found-get-function

$sf-error-function-not-found-get-function: 'function name string "$1" cannot be found. You may need to use\
  `get-function()` and first-class functions instead.\
  See http://oddbird.net/2017/03/30/safe-get' !default;

Description

Error message for when a function name cannot be found and the get-function function is availaible (Sass >= 3.5).

It is recommended to promote first-class functions to the user for a better modularization and reusability of its project.

Type

String

Used by