Has keys tester
[data/dictionary/Has keys tester]
Tests whether the key set of the dictionary contains the expected keys.
If strict
is set, extra properties are not tolerated, the dictionary provided must have exactly the expected keys.
Example A:
{ "first": 1, "third": 3, "fifth": 5 } @0 received via
dict
["first", "fifth"]@0 received via
expected keys
strict
is set to falsehas
sends true@0
Example B:
{ "first": 1, "third": 3, "fifth": 5 } @0 received via
dict
["second", "seventh"]@0 received via
expected keys
strict
is set to falsehas
sends false@0
Example C:
{ "first": 1, "third": 3, "fifth": 5 } @0 received via
dict
["first", "fifth"]@0 received via
expected keys
strict
is set to truehas
sends false@0
Keywords: dictionary, dict, has, key, contains, any, validate
Input ports
dict:
{string: any}
Receives the dictionary to test. Example: { "first": 1, "third": 3, "fifth": 5 }
expected keys:
string[]
Receives an array of expected keys. Example: [ "first", "third" ]
strict:
boolean
Receives whether extra keys in
dict
are allowed. Example: false
Output ports
has:
boolean
Sends a value indicating whether the dictionary has the expected keys. Example: true
Last updated