Write javascript predicates for conditions