Module: util/recipe-checks

A module with functions that perform runtime type checks. There are very simple checks such as isString(), there also are complex checks.

Source:

Members

(inner, constant) BANNED_MAP_KEY_TYPES :Set.<string>

Map object keys are not allowed to be complex (i.e. an object type). In Javascript those would be based on being pointers to objects in memory, but - if we used them - they would be saved as JSON string, making them content-based. That would make it impossible to reliably reproduce the original situation in memory.

Type:
  • Set.<string>
Source:

(inner, constant) ITEM_TYPE_CHECKER :Map.<string, function(ValueType): void>

This map contains ensurer functions for every type in the RecipeRule.itemtype

Type:
Source:

Methods

(inner) checkItemTypeField(typeObj, index)

Parameters:
Name Type Description
typeObj ValueType
index number

Runs checks on the RecipeRule.itemtype field

Source:

(inner) collectRulesInItemtype(thing, originalKey, matches) → {Array.<unknown>}

Parameters:
Name Type Description
thing Record.<string, unknown>
originalKey string
matches Array.<unknown>
Source:
Returns:

Type: Array.<unknown>

(static) isRuleInheritanceWithOptions(thing) → {boolean}

Parameters:
Name Type Description
thing *

An argument that can be of any type

Source:
Returns:

True if the argument is a RuleInheritanceWithOptions object, false if not

Type: boolean

(static) ensureRecipeObj(thing) → {Recipe}

Parameters:
Name Type Description
thing *

A test performed internally before adding new recipes for ONE objects.

Source:
Throws:

Throws an Error when there is an error in the recipe that our (incomplete) tests detect

Type: Error

Returns:

Returns the Recipe ONE object

Type: Recipe

(static) constructItemRuleFromListRule(rule) → {RecipeRule}

Parameters:
Name Type Description
rule RecipeRule

Construct a recipeRule based on the itemtype.item from the list rule. This is used for constructing CRDT types.

Source:
Returns:

Type: RecipeRule