use ~ trick for -1 indexOf
handle case where ID could be a falsey value
use _.keys instead of Object.keys for better support