neilenns / node-deepstackai-trigger

Detects motion using Deepstack AI and calls registered triggers based on trigger rules.
MIT License
167 stars 28 forks source link

Make object label matching case insensitive #31

Closed neilenns closed 4 years ago

neilenns commented 4 years ago

https://github.com/danecreekphotography/node-deepstackai-trigger/blob/b8e9c4bc97f5578ef87bc16b113d1e67da8d5ca8/src/TriggerManager.ts#L99

Right now if someone puts "Dog" in as the label it won't match any of the returned values from DeepStack AI. Simple fix to guard against this: convert all labels from the incoming JSON into lowercase before adding them to the trigger.

Array.map() to the rescue again!

neilenns commented 4 years ago

Schema validation prevents this from ever happening. Since the schema includes an enum of every valid label, and they are all in lower case, things won't fire up if there's a capital letter in there.

This will need to get mentioned in the property description when #25 is done.