Guard Module
Guard module — validate-and-throw in one call.
All guards are inline for zero-cost abstraction at call sites.
Functions and values
| Function or value |
Description
|
||
Full Usage:
Guard.inRange paramName lo hi value
Parameters:
string
-
Name of the parameter for the exception.
lo : 'T
-
Inclusive lower bound.
hi : 'T
-
Inclusive upper bound.
value : 'T
-
Value to validate.
Modifiers: inline Type parameters: 'T |
Throws ArgumentOutOfRangeException if value is not between lo and hi (inclusive).
|
||
Full Usage:
Guard.isFalse paramName msg condition
Parameters:
string
-
Name of the parameter for the exception.
msg : string
-
Exception message.
condition : bool
-
Condition that must be false.
Modifiers: inline |
Throws ArgumentException if condition is true.
|
||
Full Usage:
Guard.isTrue paramName msg condition
Parameters:
string
-
Name of the parameter for the exception.
msg : string
-
Exception message.
condition : bool
-
Condition that must be true.
Modifiers: inline |
Throws ArgumentException if condition is false.
|
||
Full Usage:
Guard.notEmpty paramName value
Parameters:
string
-
Name of the parameter for the exception.
value : string
-
String to check.
Modifiers: inline |
Throws ArgumentException if string is null or empty.
|
||
Full Usage:
Guard.notNegative paramName value
Parameters:
string
-
Name of the parameter for the exception.
value : ^T
-
Value that must not be negative.
Modifiers: inline Type parameters: ^T |
Throws ArgumentOutOfRangeException if value is negative.
|
||
Full Usage:
Guard.notNull paramName value
Parameters:
string
-
Name of the parameter for the exception.
value : 'T
-
Value to check for null.
Modifiers: inline Type parameters: 'T |
Throws ArgumentNullException if value is null.
|
||
Full Usage:
Guard.notWhiteSpace paramName value
Parameters:
string
-
Name of the parameter for the exception.
value : string
-
String to check.
Modifiers: inline |
Throws ArgumentException if string is null, empty, or whitespace.
|
||
Full Usage:
Guard.positive paramName value
Parameters:
string
-
Name of the parameter for the exception.
value : ^T
-
Value that must be positive.
Modifiers: inline Type parameters: ^T |
Throws ArgumentOutOfRangeException if value is less than or equal to zero.
|
TDesu.FSharp