model.js
function(key, val, options) {
    var attrs;
    if (key === null) return this;

    if (typeof key === 'object') {
      attrs = key;
      options = val;
    } else {
      (attrs = {})[key] = val;
    }

    options || (options = {});

    // Don't override unset
    if (options.unset) {
      return Backbone.Model.prototype.set.apply(this, arguments);
    }

    // Apply schema
    this._validateAttributes(attrs, this._schema, this._defaults);

    return Backbone.Model.prototype.set.call(this, attrs, options);
  }
function(key, val, options) {
    var attrs;
    if (key === null) return this;

    if (typeof key === 'object') {
      attrs = key;
      options = val;
    } else {
      (attrs = {})[key] = val;
    }

    options || (options = {});

    // Don't override unset
    if (options.unset) {
      return Backbone.Model.prototype.set.apply(this, arguments);
    }

    // Apply schema
    this._validateAttributes(attrs, this._schema, this._defaults);

    return Backbone.Model.prototype.set.call(this, attrs, options);
  }
function ( key , val , options ) { var attrs ; if ( key === null ) return this ; if ( typeof key === 'object' ) { attrs = key ; options = val ; } else { ( attrs = { } ) [ key ] = val ; } options || ( options = { } ) ; // Don't override unset if ( options . unset ) { return Backbone . Model . prototype . set . apply ( this , arguments ) ; } // Apply schema this . _validateAttributes ( attrs , this . _schema , this . _defaults ) ; return Backbone . Model . prototype . set . call ( this , attrs , options ) ; }
Backbone `set` extended with support for schema

TODO @ptshih Extend with lodash `set` (nested/deep)

@return {*}
Backbone set extended with support for schema