I have an object, as example:
{
commands: [ 'element1', 'element2', 'element3' ],
'audit-log': {
channel: 'string',
'message-events': { enabled: [ 'element1', 'element2', 'element3' ], ignored: [ 'element1', 'element2', 'element3' ] },
'moderation-events': [ 'element1', 'element2', 'element3' ]
},
enabled: [ 'element1', 'element2', 'element3' ]
}
All the strings and array elements have to be checked if a certain array includes those.
This array is different for every object element. So if the function checks enabled
in message-events
, it takes another array then when it checks the standard enabled
or ignored
in message-events
.
Example array for ignored
: [ 'element1', 'element3', 'element4' ]
. This will return false when checked, because element2
is not in the ignored
array.
Example array for enabled
: [ 'element1', 'element2', 'element3', 'element4' ]
. This will return true when checked, because every element is in the enabled
array.
Is there a way to do this in a simple function?
Via Active questions tagged javascript - Stack Overflow https://ift.tt/9LtsgKw
Comments
Post a Comment