SassFunction

Sass'sfunction type.

⚠️ Heads up!

Although first-class Sass functions can be processed by customfunctions, there’s no way to invoke them outside of a Sass stylesheet.

Hierarchy

Constructors

constructor

Accessors

asList

hasBrackets

isTruthy

realNull

separator

Methods

assertBoolean

assertCalculation

assertColor

assertFunction

assertMap

assertMixin

assertNumber

assertString

equals

get

  • get(index:number):undefined |Value
  • Returns the value at indexindex in this value as a list, orundefinedifindex isn't valid for this list.

    All SassScript values can be used as lists. Maps count as lists of pairs,and all other values count as single-value lists.

    This is a shorthand forthis.asList.get(index), although it may be moreefficient in some cases.

    ⚠️ Heads up!

    This method uses the same indexing conventions as theimmutable package: unlike Sass the index of the first element is 0, butlike Sass negative numbers index from the end of the list.

    Parameters

    • index:number

    Returnsundefined |Value

    Inherited fromValue.get

hashCode

sassIndexToListIndex

  • sassIndexToListIndex(sassIndex:Value,name?:string):number
  • ConvertssassIndex into a JavaScript-style index into the list returnedbyasList.

    Sass indexes are one-based, while JavaScript indexes are zero-based. Sassindexes may also be negative in order to index from the end of the list.

    Throws

    Error IfsassIndex isn't a number, if that number isn't aninteger, or if that integer isn't a valid index forasList.

    Parameters

    • sassIndex:Value

      The Sass-style index into this as a list.

    • Optionalname:string

      The name of the function argumentsassIndex came from(without the$) if it came from an argument. Used for error reporting.

    Returnsnumber

    Inherited fromValue.sassIndexToListIndex

tryMap