Extract watcher in class and if replaced by ternary operator