Methods
applyBinaryOperator(value, op, opValue, context) → {*}
Apply a bianry operator to a value
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
*
|
|
op |
*
|
|
opValue |
*
|
|
context |
*
|
Returns:
- Type:
-
*
applyOperator(currentValue, rightValue, opMeta, context) → {*}
Apply an operator to a value with operator meta
- Source:
Parameters:
Name | Type | Description |
---|---|---|
currentValue |
*
|
|
rightValue |
*
|
|
opMeta |
*
|
|
context |
*
|
Returns:
- Type:
-
*
applyUnaryOperator(value, tag, context) → {*}
Apply an unary operator to a value
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
*
|
|
tag |
*
|
|
context |
*
|
Returns:
- Type:
-
*
test(left, op, right, options, context) → {*}
Tests whether a left-hand value satisfies a given operator and right-hand value.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
left |
*
|
The left-hand value to test. |
op |
string
|
The operator to use for the test. |
right |
*
|
The right-hand value to test against. |
options |
Object
|
Options to use for the test. |
context |
Object
|
The current context of the data structure being validated. |
Throws:
-
If the specified operator does not have a registered validator.
- Type
-
Error
Returns:
- Type:
-
*
The result of the test.
transform(currentValue, jsx, context, replaceLeft) → {*}
If $ operator used, only one a time is allowed e.g. { $groupBy: 'key' }
- Source:
Parameters:
Name | Type | Description |
---|---|---|
currentValue |
*
|
|
jsx |
*
|
|
context |
*
|
|
replaceLeft |
boolean
|
Whether the expression will replace the left value chain, like a setOp |
Returns:
- Type:
-
*
transformCollection(currentValue, collectionOp, opMeta, expectedFieldValue, context) → {*}
Apply an collection iteration operator with operator meta
- Source:
Parameters:
Name | Type | Description |
---|---|---|
currentValue |
*
|
|
collectionOp |
*
|
|
opMeta |
*
|
|
expectedFieldValue |
*
|
|
context |
*
|
Returns:
- Type:
-
*
validate(actual, jsv, options, contextopt) → {array}
Validate the given object with JSON Expression Syntax (JES)
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
context.config |
Object
|
The configuration object for the current validation context |
|
context.path |
string
|
<optional> |
The current path of the data structure being validated |
context.THIS |
*
|
<optional> |
The current value being validated |
context.ROOT |
*
|
<optional> |
The root of the data structure being validated |
context.PARENT |
*
|
<optional> |
The parent of the current field being validated |
context.KEY |
string
|
<optional> |
The key of the current field being validated |
context.ERROR |
string
|
Array
|
<optional> |
The error message to display if the validation fails |
context.mapOfNames |
Object
|
<optional> |
A map of field names to use for error messages |
context.name |
string
|
<optional> |
The name of the current field being validated, provided by the user |
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
actual |
*
|
The object to match |
|
jsv |
*
|
Expected state in JSON Expression Syntax |
|
options |
*
|
Validation options |
|
context |
*
|
<optional> |
Validation context |
Returns:
- Type:
-
array
- [ {boolean} matched, {string} unmatchedReason ]