Precondition utility for JavaScript to simplify common precondition or state checking.