Validation

Each argument to Su has a single canonical syntax. These validation functions check to ensure that each argument is valid, in order to provide useful errors before attempting to calculate the results/

@function su-valid-span()

Description

Check that the span argument is a number, length, or column-list

Parameters & Return

$span: (number | list)

Number of columns, or length of span

@return (number | list)

Validated $span number, length, or columns list

@error

when span value is not a number, or valid column list

requires

@function _susy-error() [private]

used by

@function su-span()

@function _su-sum() [private]

@function _su-calc-span() [private]

@function _su-calc-sum() [private]

@function _su-needs-calc-output() [private]

@function su-valid-columns()

Description

Check that the columns argument is a valid list of column-lengths

Parameters & Return

$columns: (list)

List of column-lengths

$silent-failure: true (bool)

Set false to return null on failure

@return (list)

Validated $columns list

@error

when column value is not a valid list of numbers

requires

@function _susy-error() [private]

used by

@function su-span()

@function su-slice()

@function _su-calc-span() [private]

@function _su-needs-calc-output() [private]

@function _susy-svg-offset() [private]

@function susy-parse()

@function su-valid-span()

@function su-valid-gutters()

Description

Check that the gutters argument is a valid number

Parameters & Return

$gutters: (number)

Width of a gutter

@return (number)

Validated $gutters number

@error

when gutter value is not a number

requires

@function _susy-error() [private]

used by

@function su-span()

@function _su-sum() [private]

@function _su-calc-span() [private]

@function _su-calc-sum() [private]

@function _su-needs-calc-output() [private]

@function _susy-svg-offset() [private]

@function su-valid-spread()

Description

Check that the spread argument is a valid intiger between -1 and 1

Parameters & Return

$spread: (0 | 1 | -1)

Number of gutters to include in a span, relative to the number columns

@return (0 | 1 | -1)

Validated $spread number

@error

when spread value is not a valid spread

requires

@function _susy-error() [private]

used by

@function su-span()

@function _su-sum() [private]

@function _su-calc-span() [private]

@function _su-calc-sum() [private]

@function _susy-svg-offset() [private]

@function su-valid-location()

Description

Check that the location argument is a valid number, within the scope of available columns

Parameters & Return

$span: (number)

Number of grid-columns to be spanned

$location: (integer | string)

Starting (1-indexed) column-position of that span

$columns: (list)

List of available columns in the grid

@return (integer)

Validated $location intiger

@error

when location value is not a valid index, given the context and span.

requires

@function _susy-error() [private]

used by

@function su-span()

@function su-slice()