assertion
functions
assert-equal
@function assert-equal($pExpected, $pValue, $pMessage: _equal_fail($pExpected), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be equal to $pExpected
.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pExpected | the value expected from | Any | — none |
$pValue | the value to test against | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _equal_fail($pExpected) |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws an error
Requires
- [function]
throw
Used by
- [mixin]
assert-equal
assert-unequal
@function assert-unequal($pUnexpected, $pValue, $pMessage: _unequal_fail($pExpected), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be unequal to $pUnexpected
.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pUnexpected | the value not expected from | Any | — none |
$pValue | the value to test against | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _unequal_fail($pExpected) |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws an error
Requires
- [function]
throw
Used by
- [mixin]
assert-unequal
assert-true
@function assert-true($pValue, $pMessage: "condition must be true", $pHandler: default-throw-handler()) { ... }
Description
Asserts $pCondition
to be equal to true.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to check | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | "condition must be true" |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pCondition
is returned. - If the assertion fails and the handler does not terminate,
$pCondition
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws an error
Requires
- [function]
throw
Used by
- [mixin]
assert-true
assert-false
@function assert-false($pValue, $pMessage: "condition must be false", $pHandler: default-throw-handler()) { ... }
Description
Asserts $pCondition
to be equal to false.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to check | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | "condition must be false" |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pCondition
is returned. - If the assertion fails and the handler does not terminate,
$pCondition
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws an error
Requires
- [function]
throw
- [function]
is-number
- [function]
has-unit
- [function]
unit-resolutions
Used by
- [mixin]
assert-false
[private] _equal_fail
@function _equal_fail($pExpected) { ... }
Description
Returns an error message that is specific to when the equal
assertion fails.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pExpected | the expected value | Any | — none |
Returns
String
—the final error message
[private] _unequal_fail
@function _unequal_fail($pExpected) { ... }
Description
Returns an error message that is specific to when the unequal
assertion fails.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pExpected | the expected value | Any | — none |
Returns
String
—the final error message
default-throw-handler
@function default-throw-handler() { ... }
Description
Returns the default throw-handler used for assertions. The currently defined default handler is the 'exit' handler, that, by default, throws an error using the at-error directive which terminates the compilation when invoked. The termination is not guaranteed since the 'exit' handler can be overridden using throw-handler-replace
, which might change the implementation details.
Parameters
None.
Returns
Function
—the handler function associated with 'exit'
Requires
- [function]
throw-exit-handler
- [function]
throw-handler-get
check-is-empty
@function check-is-empty($pIterableOrString, $pMessage: "must be empty", $pHandler: default-throw-handler()) { ... }
Description
Asserts $pIterableOrString
to be empty. The asserted value ($pIterableOrString
) must either be type of string, list, map or arglist. If it is neither, the assertion fails.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pIterableOrString | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | "must be empty" |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail, given value is returned.
- If the assertion fails and the handler does not terminate, given value is returned if the handler returns null. Otherwise, returns the handler's return value.
- Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
check-not-empty
@function check-not-empty($pIterableOrString, $pMessage: "must not be empty", $pHandler: default-throw-handler()) { ... }
Description
Asserts $pIterableOrString
to not be empty. The asserted value ($pIterableOrString
) must either be type of string, list, map or arglist. If it is neither, the assertion succeeds.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pIterableOrString | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | "must not be empty" |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail, given value is returned.
- If the assertion fails and the handler does not terminate, given value is returned if the handler returns null. Otherwise, returns the handler's return value.
- Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
check-is-map
@function check-is-map($pValue, $pMessage: _generic_fail($pValue, "not a map"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be of type map.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a map") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
check-is-list
@function check-is-list($pValue, $pMessage: _generic_fail($pValue, "not a list"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be of type list.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a list") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
check-is-arglist
@function check-is-arglist($pValue, $pMessage: _generic_fail($pValue, "not an arglist"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be of type arglist.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not an arglist") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
- [function]
is-arglist
- [function]
throw
check-is-function
@function check-is-function($pValue, $pMessage: _generic_fail($pValue, "not a function"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be of type function.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a function") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
- [function]
is-function
- [function]
throw
check-is-iterable
@function check-is-iterable($pValue, $pMessage: _generic_fail($pValue, "not an iterable"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be of type iterable. An iterable is either a list, arglist or map.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not an iterable") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
- [function]
is-iterable
- [function]
throw
check-is-undefined
@function check-is-undefined($pValue, $pMessage: _generic_fail($pValue, "not undefined"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be undefined. Undefined means it is either literal null or "none".
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not undefined") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
- [function]
is-undefined
- [function]
throw
check-is-primitive
@function check-is-primitive($pValue, $pMessage: _generic_fail($pValue, "not a primitive"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be a primitive. A primitive is either a string, number, color or boolean.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a primitive") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
- [function]
is-primitive
- [function]
throw
check-is-string
@function check-is-string($pValue, $pMessage: _generic_fail($pValue, "not a string"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be of type string.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a string") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
check-is-number
@function check-is-number($pValue, $pMessage: _generic_fail($pValue, "not a number"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be of type number.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a number") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
check-is-color
@function check-is-color($pValue, $pMessage: _generic_fail($pValue, "not a color"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be of type color.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a color") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
check-is-bool
@function check-is-bool($pValue, $pMessage: _generic_fail($pValue, "not a boolean"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be a boolean (type of bool).
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a boolean") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
check-is-truthy
@function check-is-truthy($pValue, $pMessage: _generic_fail($pValue, "not truthy"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be extensively truthy. A value is extensively truthy if it is natively truthy and neither an empty string, an empty list, an empty map nor numeric null.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not truthy") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
check-is-falsy
@function check-is-falsy($pValue, $pMessage: _generic_fail($pValue, "not falsy"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be extensively falsy. A value is extensively falsy if it is natively falsy or either an empty string, an empty list, an empty map or numeric null.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not falsy") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
check-has-unit
@function check-has-unit($pValue, $pUnitList, $pMessage: _has_unit_fail($pValue, $pUnitList), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to has a unit that is contained in given list.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test (not the unit standalone) | Any | — none |
$pUnitList | the list of all units to spec for | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _has_unit_fail($pValue, $pUnitList) |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
check-is-time
@function check-is-time($pValue, $pMessage: _generic_fail($pValue, "not a time"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be a time value.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a time") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
check-is-duration
@function check-is-duration($pValue, $pMessage: _generic_fail($pValue, "not a duration"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be a duration.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a duration") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
- [function]
is-duration
- [function]
throw
check-is-angle
@function check-is-angle($pValue, $pMessage: _generic_fail($pValue, "not an angle"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be an angle.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not an angle") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
check-is-frequency
@function check-is-frequency($pValue, $pMessage: _generic_fail($pValue, "not a frequency"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be a frequency.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a frequency") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
- [function]
is-frequency
- [function]
throw
check-is-integer
@function check-is-integer($pValue, $pMessage: _generic_fail($pValue, "not an integer"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be an integer.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not an integer") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
- [function]
is-integer
- [function]
throw
check-is-relative-length
@function check-is-relative-length($pValue, $pMessage: _generic_fail($pValue, "not a relative length"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be a relative length.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a relative length") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
- [function]
is-relative-length
- [function]
throw
check-is-absolute-length
@function check-is-absolute-length($pValue, $pMessage: _generic_fail($pValue, "not an absolute length"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be an absolute length.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not an absolute length") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
- [function]
is-absolute-length
- [function]
throw
check-is-percentage
@function check-is-percentage($pValue, $pMessage: _generic_fail($pValue, "not a percentage"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be a percentage.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a percentage") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
- [function]
is-percentage
- [function]
throw
check-is-length
@function check-is-length($pValue, $pMessage: _generic_fail($pValue, "not a length"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be a relative or absolute length.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a length") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
check-is-resolution
@function check-is-resolution($pValue, $pMessage: _generic_fail($pValue, "not a resolution"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be a resolution.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a resolution") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
- [function]
is-resolution
- [function]
throw
check-is-position
@function check-is-position($pValue, $pMessage: _generic_fail($pValue, "not a position"), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be a position.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _generic_fail($pValue, "not a position") |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Returns
Returns conditionally.
- If the assertion does not fail,
$pValue
is returned. - If the assertion fails and the handler does not terminate,
$pValue
is returned if the handler returns null. Otherwise, returns the handler's return value. - Returns never if the assertion fails and the handler terminates (as in stops the compilation).
Throws
if the assertion fails and the handler throws
Requires
- [function]
is-position
- [function]
throw
mixins
assert-equal
@mixin assert-equal($pExpected, $pValue, $pMessage: _equal_fail($pExpected), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be equal to $pExpected
. This mixin is an alias for the function assert-equal
.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pExpected | the value expected from | Any | — none |
$pValue | the value to test against | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _equal_fail($pExpected) |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Throws
if the assertion fails and the handler throws an error
Requires
- [function]
assert-equal
assert-unequal
@mixin assert-unequal($pUnexpected, $pValue, $pMessage: _equal_fail($pExpected), $pHandler: default-throw-handler()) { ... }
Description
Asserts $pValue
to be unequal to $pUnexpected
. This mixin is an alias for the function assert-unequal
.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pUnexpected | the value not expected from | Any | — none |
$pValue | the value to test against | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | _equal_fail($pExpected) |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Throws
if the assertion fails and the handler throws an error
Requires
- [function]
assert-unequal
assert-true
@mixin assert-true($pValue, $pMessage: "condition must be true", $pHandler: default-throw-handler()) { ... }
Description
Asserts $pCondition
to be equal to true. This mixin is an alias for the function assert-true
.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to check | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | "condition must be true" |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Throws
if the assertion fails and the handler throws an error
Requires
- [function]
assert-true
assert-false
@mixin assert-false($pValue, $pMessage: "condition must be false", $pHandler: default-throw-handler()) { ... }
Description
Asserts $pCondition
to be equal to false. This mixin is an alias for the function assert-false
.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to check | Any | — none |
$pMessage | the error message if this assertion fails (optional) | Any | "condition must be false" |
$pHandler | the handler that is used if the assertion fails (optional) | String or Function | default-throw-handler() |
Throws
if the assertion fails and the handler throws an error
Requires
- [function]
assert-false
error
handler name with throw-invoke.
variables
[private] _ErrorHandlers
$_ErrorHandlers: (
// <HANDLER> ::= <HANDLER_NAME>: <HANDLER_FUNCTION>
// Following are default handlers compliant with `handler-add`
'exit': meta.get-function('error', $module: report),
'warn': meta.get-function('warn', $module: report)
) !default;
Description
A private map of all throw-handler functions associated to their handler name. This map acts as a registry of throw-handlers used to handle certain exception throws with better Developer Experience (DX).
Type
Map
Used by
- [function]
throw-handlers
- [function]
throw-handler-exists
- [function]
throw-handler-get
- [function]
throw-invoke
- [function]
throw-invoke
functions
throw-handlers
@function throw-handlers() { ... }
Description
Returns the global map of all current throw-handler functions associated to their handler names.
Parameters
None.
Returns
Map
—the handler register map
Requires
- [variable]
_ErrorHandlers
throw-handler-exists
@function throw-handler-exists($pHandlerName) { ... }
Description
Returns true if a handler (function) with given name currently exists. The letter casing does matter.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pHandlerName | the name of the target handler | String | — none |
Returns
Boolean
—true if a handler with given name exists
Throws
Error if
$pHandlerName
is not a string
Requires
- [variable]
_ErrorHandlers
- [function]
is-string
Used by
- [function]
throw-handler-get
- [function]
throw-handler-add
- [function]
throw-handler-replace
throw-handler-get
@function throw-handler-get($pHandlerName) { ... }
Description
Returns the with given name associated handler function, if found. If no handler with given name is found, an error is thrown.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pHandlerName | the name of the target handler | String | — none |
Returns
Function
—the function associated with given name
Throws
Error if no handler
$pHandlerName
is found
Requires
- [variable]
_ErrorHandlers
- [function]
throw-handler-exists
Used by
- [function]
default-throw-handler
- [function]
throw-invoke
throw-handler-add
@function throw-handler-add($pHandlerName, $pHandlerFunction) { ... }
Description
Associates $pHandlerFunction
with $pHandlerName
in the global handler map if no handler with given name exists. If a handler with given name is already known, an error is thrown. A handler function must accept one argument that is the error message. Registered handler functions can be invoked using their handler name with throw-invoke.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pHandlerName | name of the new handler | String | — none |
$pHandlerFunction | function of the new handler. The function accepts one argument being the error message (any type) and returns whatever. If the function returns null on invocation, the return value may be discarded and another value prioritised, but a non-null return should not be discarded. | Function | — none |
Returns
String
—$pHandlerName
if the operation succeeded
Throws
Error if a handler with given name is already existing, or if
$pHandlerFunction
is not a valid function reference.
Requires
- [function]
throw-handler-exists
- [function]
is-function
throw-handler-replace
@function throw-handler-replace($pHandlerName, $pHandlerFunction) { ... }
Description
Replaces the with $pHandlerName
associated function with $pHandlerFunction
if there is a handler with given name. If no handler with an equal name is found, an error is thrown. A handler function must accept one argument that is the error message. Registered handler functions can be invoked using their handler name with throw-invoke.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pHandlerName | name of the handler to replace | String | — none |
$pHandlerFunction | the new function of the handler. The function accepts one argument being the error message (any type) and returns whatever. If the function returns null on invocation, the return value may be discarded and another value prioritised, but a non-null return should not be discarded. | Function | — none |
Returns
String
—$pHandlerName
if the operation succeeded
Throws
Error if no handler with given name is currently existing, or if
$pHandlerFunction
is not a valid function reference.
Requires
- [function]
throw-handler-exists
- [function]
is-function
throw-invoke
@function throw-invoke($pHandler, $vaArgs...) { ... }
Description
Invokes $pHandler
with $vaArgs
as the call arguments.
- If
$pHandler
is a string, the function associated to given string is called using$vaArgs
. If that function is not found, as in no handler with$pHandler
as name is found, an error is thrown. - If
$pHandler
is a function, the function is called immediately using given$vaArgs
.
If $pHandler
is neither a string nor a function, an error is thrown.
Be aware: usually $vaArgs
should be exactly one argument, since all handler functions are required to accept one argument. But theoretically, if you invoke custom handlers, you can pass more arguments to them using this function.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pHandler | the target handler to invoke. Can be a string to reference an existing handler, or a function that is not required to be registered as a handler - as in not required to be associated to a certain handler name in the handler map. | Function or String | — none |
$vaArgs | the arguments passed to the call of the handler | Arglist | — none |
Returns
the result of the handler function call
Throws
Error if the invoke failed,
$pHandler
is not a string nor a function, or if$pHandler
is a string but no handler with that string as a name is found.
Requires
- [function]
is-function
- [function]
is-string
- [variable]
_ErrorHandlers
- [variable]
_ErrorHandlers
- [function]
throw-handler-get
Used by
- [function]
throw
throw-exit-handler
@function throw-exit-handler() { ... }
Description
Returns the exit
handler, that when invoked throws an error with input message and terminates the compilation, by default. The termination of the compilation is not guaranteed, since the exit-handler's implementation can be overwritten, but should not.
Parameters
None.
Returns
Function
—the exit handler function
Used by
- [function]
default-throw-handler
- [mixin]
exit-throw
- [function]
warn-throw
- [mixin]
warn-throw
throw-warn-handler
@function throw-warn-handler() { ... }
Description
Returns the warn
handler, that when invoked throws a warning with input message and continues the compilation, by default. The return value of that function is always null.
Parameters
None.
Returns
Function
—the warn handler function
report-error
@function report-error($pMessage) { ... }
Description
Simple referencable function that throws an error with given message. It utilizes the at-error directive, if available, which terminates the compilation.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pMessage | the error message | Any | — none |
Returns
Never
or Null
—never returns unless the at-error directive is disabled, which will trigger a warning and a null return
report-warn
@function report-warn($pMessage, $pReturnValue: null) { ... }
Description
Simple referencable function that throws a warning with given message. It utilizes the at-warn directive.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pMessage | the warn message | Any | — none |
$pReturnValue | the value returned after warning (optional) | Any | null |
Returns
returns $pReturnValue
throw
@function throw($pMessage, $pHandler: handlers.exit-handler(), $pIfNull: null) { ... }
Description
Invokes given handler with $pMessage
as the call argument.
- If
$pHandler
is a string, the function associated to given string is called using$pMessage
. If that function is not found, as in no handler with$pHandler
as a name is found in the handler map, an error is thrown. - If
$pHandler
is a function, the function is called immediately using given$pMessage
as argument. - If
$pHandler
is undefined, as in literal null or "none", the handler is not invoked and$pIfNull
returned. The throw is essentially ignored - so be careful with passing the right handler.
If the result of the function call on the handler is not null, the result is returned. Otherwise, $pIfNull
is returned.
If $pHandler
is neither undefined (null or "none), a function nor a string, an error is thrown.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pMessage | the error message passed to the handler | Any | — none |
$pHandler | the target handler to invoke. Can be a string to reference an existing handler, or a function that is not required to be registered as a handler - as in not required to be associated to a certain handler name in the handler map. (optional) | Function or String | handlers.exit-handler() |
$pIfNull | the value returned alternatively, if the function call on the final handler that is used returns null (optional) | Any | null |
Returns
Returns conditionally.
- Returns never if the used handler terminates the compilation.
- If the handler does not terminate,
$pIfNull
is returned if the result of the handler invocation is null. Otherwise, returns the result of the invocation.
Throws
Error if the invoke failed, the handler throws,
$pHandler
is neither undefined, a string nor a function, or if$pHandler
is a string but no handler with that string as a name is found in the handler map.
Requires
- [function]
is-undefined
- [function]
nonnull-or
- [function]
throw-invoke
Used by
- [function]
assert-equal
- [function]
assert-unequal
- [function]
assert-true
- [function]
assert-false
- [function]
check-is-empty
- [function]
check-not-empty
- [function]
check-is-map
- [function]
check-is-list
- [function]
check-is-arglist
- [function]
check-is-function
- [function]
check-is-iterable
- [function]
check-is-undefined
- [function]
check-is-primitive
- [function]
check-is-string
- [function]
check-is-number
- [function]
check-is-color
- [function]
check-is-bool
- [function]
check-is-truthy
- [function]
check-is-falsy
- [function]
check-has-unit
- [function]
check-is-time
- [function]
check-is-duration
- [function]
check-is-angle
- [function]
check-is-frequency
- [function]
check-is-integer
- [function]
check-is-relative-length
- [function]
check-is-absolute-length
- [function]
check-is-percentage
- [function]
check-is-length
- [function]
check-is-resolution
- [function]
check-is-position
- [mixin]
throw
- [mixin]
exit-throw
- [function]
warn-throw
- [mixin]
warn-throw
warn-throw
@function warn-throw($pMessage, $pIfNull: null) { ... }
Description
Throws a warning using given message and the default throw-warn-handler.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pMessage | the message passed to the warn handler | Any | — none |
$pIfNull | the value returned alternatively, if the function call on the warn handler returns null - which it does by default (optional) | Any | null |
Returns
Returns conditionally.
- Returns never if the used handler terminates the compilation.
- If the handler does not terminate,
$pIfNull
is returned if the result of the handler invocation is null. Otherwise, returns the result of the invocation.
Throws
error if the handler throws (which it does by default)
Requires
- [function]
throw-exit-handler
- [function]
throw
Used by
- [mixin]
warn-throw
mixins
throw
@mixin throw($pMessage, $pHandler: handlers.exit-handler(), $pIfNull: null) { ... }
Description
Mixin alias that invokes throw using given arguments.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pMessage | the error message passed to the handler | Any | — none |
$pHandler | the target handler to invoke. Can be a string to reference an existing handler, or a function that is not required to be registered as a handler - as in not required to be associated to a certain handler name in the handler map. (optional) | Function or String | handlers.exit-handler() |
$pIfNull | the value returned alternatively, if the function call on the final handler that is used returns null (optional) | Any | null |
Throws
Error if the invoke failed, the handler throws,
$pHandler
is neither undefined, a string nor a function, or if$pHandler
is a string but no handler with that string as a name is found in the handler map.
Requires
- [function]
throw
exit-throw
@mixin exit-throw($pMessage) { ... }
Description
Throws an error using given message and the default throw-exit-handler, that terminates the compilation by default.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pMessage | the message passed to the exit handler | Any | — none |
Throws
error if the handler throws (which it does by default)
Requires
- [function]
throw-exit-handler
- [function]
throw
warn-throw
@mixin warn-throw($pMessage) { ... }
Description
Throws a warning using given message and the default throw-warn-handler.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pMessage | the message passed to the warn handler | Any | — none |
Throws
error if the handler throws (which it does by default)
Requires
- [function]
warn-throw
- [function]
throw-exit-handler
- [function]
throw
utils
functions
nonnull-or
@function nonnull-or($pValue, $pIfNull) { ... }
Description
Returns $pValue
if $pValue
is not null. Otherwise, returns $pIfNull
.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test to be not null | Any | — none |
$pIfNull | the value returned if | Any | — none |
Returns
$pValue
if not null, else $pIfNull
Used by
- [function]
throw
truthy-or
@function truthy-or($pValue, $pIfFalsy) { ... }
Description
Returns $pValue
if $pValue
is extensively truthy. Otherwise, returns $pIfFalsy
. Given value is extensively truthy if it is neither numeric zero, an empty list, an empty map, an empty string nor false or null.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test to be truthy | Any | — none |
$pIfFalsy | the value returned if | Any | — none |
Returns
$pValue
if truthy, else $pIfFalsy
Requires
- [function]
is-truthy
falsy-or
@function falsy-or($pValue, $pIfTruthy) { ... }
Description
Returns $pValue
if $pValue
is extensively falsy. Otherwise, returns $pIfTruthy
. Given value is extensively falsy if it is either numeric zero, an empty list, an empty map, an empty string, false or null.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test to be falsy | Any | — none |
$pIfTruthy | the value returned if | Any | — none |
Returns
$pValue
if falsy, else $pIfTruthy
Requires
- [function]
is-falsy
is-empty
@function is-empty($pValue) { ... }
Description
Returns true if $pValue
is empty. Given value must either be of type list, arglist, map or string. If the value is neither type, false is returned.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | — none | List or Arglist or Map or String | — none |
Returns
Boolean
—true if $pValue
is empty
Requires
- [function]
count
Used by
- [function]
check-is-empty
- [function]
check-not-empty
count
@function count($pIterableOrString, $pFallback) { ... }
Description
Returns the length of $pIterableOrString
and returns $pFallback
if it is neither of type list, arglist, map nor string.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pIterableOrString | the value which list or string length is returned (if possible) | List or Arglist or Map or String | — none |
$pFallback | returned if the value is neither an iterable nor a string | Any | — none |
Returns
Boolean
—the length of given value if possible, else $pFallback
Requires
- [function]
is-iterable
- [function]
is-string
Used by
- [function]
is-empty
is-map
@function is-map($pValue) { ... }
Description
Returns true if $pValue
is of type map.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a map
Used by
- [function]
check-is-map
- [function]
is-iterable
is-list
@function is-list($pValue) { ... }
Description
Returns true if $pValue
is of type list.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a list
Used by
- [function]
check-is-list
- [function]
is-iterable
- [function]
has-unit
is-arglist
@function is-arglist($pValue) { ... }
Description
Returns true if $pValue
is of type arglist.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is an arglist
Used by
- [function]
check-is-arglist
- [function]
is-iterable
is-function
@function is-function($pValue) { ... }
Description
Returns true if $pValue
is of type function.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a function
Used by
- [function]
check-is-function
- [function]
throw-handler-add
- [function]
throw-handler-replace
- [function]
throw-invoke
is-iterable
@function is-iterable($pValue) { ... }
Description
Returns true if $pValue
is an iterable. Given value is an iterable if it is either a list, an arglist or a map.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is an iterable
Requires
- [function]
is-list
- [function]
is-arglist
- [function]
is-map
Used by
- [function]
check-is-iterable
- [function]
count
is-undefined
@function is-undefined($pValue) { ... }
Description
Returns true if $pValue
is undefined. A value is undefined if it is null or "none".
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is undefined
Used by
- [function]
check-is-undefined
- [function]
throw
is-primitive
@function is-primitive($pValue) { ... }
Description
Returns true if $pValue
is a primitive. Given value is a primitive if it is either a string, number, color or boolean.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a primitive
Requires
Used by
- [function]
check-is-primitive
is-string
@function is-string($pValue) { ... }
Description
Returns true if $pValue
is a string.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a string
Used by
- [function]
check-is-string
- [function]
throw-handler-exists
- [function]
throw-invoke
- [function]
count
- [function]
is-primitive
is-number
@function is-number($pValue) { ... }
Description
Returns true if $pValue
is a number.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a number
Used by
- [function]
assert-false
- [function]
check-is-number
- [function]
is-primitive
- [function]
is-time
- [function]
is-angle
- [function]
is-frequency
- [function]
is-integer
- [function]
is-relative-length
- [function]
is-absolute-length
- [function]
is-percentage
- [function]
is-resolution
is-color
@function is-color($pValue) { ... }
Description
Returns true if $pValue
is a color.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a color
Used by
- [function]
check-is-color
- [function]
is-primitive
is-bool
@function is-bool($pValue) { ... }
Description
Returns true if $pValue
is a boolean.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a boolean
Used by
- [function]
check-is-bool
- [function]
is-primitive
as-boolean
@function as-boolean($pValue) { ... }
Description
Returns a boolean value if $pValue
is natively truthy. A value is natively truthy if it is not null and not false.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to return as a boolean | Any | — none |
Returns
Boolean
—true if $pValue
is truthy
is-truthy
@function is-truthy($pValue) { ... }
Description
Returns true if $pValue
is extensively truthy. A value is extensively truthy if it is natively truthy and neither an empty string, an empty list, an empty map nor numeric null.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a extensively truthy
Used by
- [function]
check-is-truthy
- [function]
truthy-or
- [function]
is-falsy
- [function]
has-unit
is-falsy
@function is-falsy($pValue) { ... }
Description
Returns true if $pValue
is extensively falsy. A value is extensively falsy if it is natively falsy or either an empty string, an empty list, an empty map or numeric null.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a extensively falsy
Requires
- [function]
is-truthy
Used by
- [function]
check-is-falsy
- [function]
falsy-or
has-unit
@function has-unit($pValue) { ... }
Description
Returns true if the $pValue
's unit is contained in $pUnitList
.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pUnitList
contains the unit of $Value
Requires
Used by
- [function]
assert-false
- [function]
check-has-unit
- [function]
is-time
- [function]
is-angle
- [function]
is-frequency
- [function]
is-relative-length
- [function]
is-absolute-length
- [function]
is-resolution
- [function]
is-position
is-time
@function is-time($pValue) { ... }
Description
Returns true if $pValue
is a time or duration.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a time value
Requires
- [function]
is-number
- [function]
has-unit
- [function]
unit-times
Used by
- [function]
check-is-time
- [function]
is-duration
is-duration
@function is-duration($pValue) { ... }
Description
Returns true if $pValue
is a duration or time.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a time value
Requires
- [function]
is-time
- [function]
unit-times
Used by
- [function]
check-is-duration
is-angle
@function is-angle($pValue) { ... }
Description
Returns true if $pValue
is an angle.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is an angle value
Requires
- [function]
is-number
- [function]
has-unit
- [function]
unit-angles
Used by
- [function]
check-is-angle
is-frequency
@function is-frequency($pValue) { ... }
Description
Returns true if $pValue
is a frequency.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a frequency value
Requires
- [function]
is-number
- [function]
has-unit
- [function]
unit-frequencies
Used by
- [function]
check-is-frequency
is-integer
@function is-integer($pValue) { ... }
Description
Returns true if $pValue
is an integer.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is an integer
Requires
- [function]
is-number
Used by
- [function]
check-is-integer
is-relative-length
@function is-relative-length($pValue) { ... }
Description
Returns true if $pValue
is a relative length.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a relative length
Requires
- [function]
is-number
- [function]
has-unit
- [function]
unit-relative-lengths
Used by
- [function]
check-is-relative-length
- [function]
is-length
is-absolute-length
@function is-absolute-length($pValue) { ... }
Description
Returns true if $pValue
is an absolute length.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is an absolute length
Requires
- [function]
is-number
- [function]
has-unit
- [function]
unit-absolute-lengths
Used by
- [function]
check-is-absolute-length
- [function]
is-length
is-percentage
@function is-percentage($pValue) { ... }
Description
Returns true if $pValue
is a percentage.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a percentage
Requires
- [function]
is-number
Used by
- [function]
check-is-percentage
- [function]
is-position
is-length
@function is-length($pValue) { ... }
Description
Returns true if $pValue
is a length value. Given value is a length if it is either a relative- or absolute length.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a length value
Requires
- [function]
is-relative-length
- [function]
is-absolute-length
Used by
- [function]
check-is-length
- [function]
is-position
is-resolution
@function is-resolution($pValue) { ... }
Description
Returns true if $pValue
is a resolution.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a resolution
Requires
- [function]
is-number
- [function]
has-unit
- [function]
unit-resolutions
Used by
- [function]
check-is-resolution
is-position
@function is-position($pValue) { ... }
Description
Returns true if $pValue
is a position.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$pValue | the value to test | Any | — none |
Returns
Boolean
—true if $pValue
is a position
Requires
- [function]
is-length
- [function]
is-percentage
- [function]
has-unit
- [function]
unit-positions
Used by
- [function]
check-is-position
unit-times
@function unit-times() { ... }
Description
Returns a list of all CSS time units.
Parameters
None.
Returns
List
—a list of all time units
Used by
- [function]
is-time
- [function]
is-duration
unit-angles
@function unit-angles() { ... }
Description
Returns a list of all CSS angle units.
Parameters
None.
Returns
List
—a list of all angle units
Used by
- [function]
is-angle
unit-frequencies
@function unit-frequencies() { ... }
Description
Returns a list of all CSS frequency units.
Parameters
None.
Returns
List
—a list of all angle units
Used by
- [function]
is-frequency
unit-relative-lengths
@function unit-relative-lengths() { ... }
Description
Returns a list of all CSS relative length units.
Parameters
None.
Returns
List
—a list of all relative length units
Used by
- [function]
is-relative-length
unit-absolute-lengths
@function unit-absolute-lengths() { ... }
Description
Returns a list of all CSS absolute length units.
Parameters
None.
Returns
List
—a list of all absolute length units
Used by
- [function]
is-absolute-length
unit-resolutions
@function unit-resolutions() { ... }
Description
Returns a list of all CSS resolution units.
Parameters
None.
Returns
List
—a list of all resolution units
Used by
- [function]
assert-false
- [function]
is-resolution
unit-positions
@function unit-positions() { ... }
Description
Returns a list of all CSS position units.
Parameters
None.
Returns
List
—a list of all position units
Used by
- [function]
is-position