expect the unexpected - design by contract in JavaScript