Methods
addSubcondition(subcondition, weightopt)
Add a subcondition (unfulfilled).
This can be used to generate a new threshold condition from a set of subconditions or to provide a non-fulfilled subcondition when creating a threshold fulfillment.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
subcondition |
Condition | Condition to add |
||
weight |
Number |
<optional> |
1 | Integer weight of the subcondition. |
- Source:
addSubconditionUri(Subcondition)
Add a subcondition (unfulfilled).
This will automatically parse the URI and call addSubcondition.
Parameters:
| Name | Type | Description |
|---|---|---|
Subcondition |
String | URI. |
- Source:
addSubfulfillment(Fulfillment, weightopt)
Add a fulfilled subcondition.
When constructing a threshold fulfillment, this method allows you to provide a fulfillment for one of the subconditions.
Note that you do not have to add the subcondition if you're adding the fulfillment. The condition can be calculated from the fulfillment and will be added automatically.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
Fulfillment |
Fulfillment | to add |
||
weight |
Number |
<optional> |
1 | Integer weight of the subcondition. |
- Source:
addSubfulfillmentUri(Subfulfillment)
Add a fulfilled subcondition.
This will automatically parse the URI and call addSubfulfillment.
Parameters:
| Name | Type | Description |
|---|---|---|
Subfulfillment |
String | URI. |
- Source:
getBitmask() → {Number}
Get full bitmask.
This is a type of condition that can contain subconditions. A complete bitmask must contain the set of types that must be supported in order to validate this fulfillment. Therefore, we need to calculate the bitwise OR of this condition's FEATURE_BITMASK and all subcondition's and subfulfillment's bitmasks.
- Source:
Returns:
Complete bitmask for this fulfillment.
- Type
- Number
setThreshold(threshold)
Set the threshold.
Determines the weighted threshold that is used to consider this condition fulfilled. If the added weight of all valid subfulfillments is greater or equal to this number, the threshold condition is considered to be fulfilled.
Parameters:
| Name | Type | Description |
|---|---|---|
threshold |
Number | Integer threshold |
- Source:
validate(message) → {Boolean}
Check whether this fulfillment meets all validation criteria.
This will validate the subfulfillments and verify that there are enough subfulfillments to meet the threshold.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
Buffer | Message to validate against. |
- Source:
Returns:
Whether this fulfillment is valid.
- Type
- Boolean