documentcloud/backbone — pull request #1768 by kiall (2012-10-23 11:53:13+00:00)
Title: Optionally allow set() to accept an invalid value

This change allows us to choose of `Model.set()` should bail early when it receives an invalid value.

This is useful for more complex validation scenarios - Contrived example:

model.set('age', 5); // Valid
model.set('isAdult', true, {allowInvalid: true}); // Invalid - Adults must be 18 years or older
model.set('age', 18); // Valid again

console.log(model.get('isAdult')); // Outputs `true`, rather than `false`

Tests included.