public/lib/emberjs/ember.js
function set(obj, keyName, value, tolerant) {
      if (typeof obj === 'string') {
        Ember.assert("Path '" + obj + "' must be global if no obj is given.", IS_GLOBAL.test(obj));
        value = keyName;
        keyName = obj;
        obj = null;
      }

      Ember.assert("Cannot call set with "+ keyName +" key.", !!keyName);

      if (!obj) {
        return setPath(obj, keyName, value, tolerant);
      }

      var meta = obj['__ember_meta__'];
      var desc = meta && meta.descs[keyName];
      var isUnknown, currentValue;

      if (desc === undefined && isPath(keyName)) {
        return setPath(obj, keyName, value, tolerant);
      }

      Ember.assert("You need to provide an object and key to `set`.", !!obj && keyName !== undefined);
      Ember.assert('calling set on destroyed object', !obj.isDestroyed);

      if (desc !== undefined) {
        desc.set(obj, keyName, value);
      } else {

        if (typeof obj === 'object' && obj !== null && value !== undefined && obj[keyName] === value) {
          return value;
        }

        isUnknown = 'object' === typeof obj && !(keyName in obj);

        // setUnknownProperty is called if `obj` is an object,
        // the property does not already exist, and the
        // `setUnknownProperty` method exists on the object
        if (isUnknown && 'function' === typeof obj.setUnknownProperty) {
          obj.setUnknownProperty(keyName, value);
        } else if (meta && meta.watching[keyName] > 0) {
          
            if (hasPropertyAccessors) {
              currentValue = meta.values[keyName];
            } else {
              currentValue = obj[keyName];
            }
                    // only trigger a change if the value has changed
          if (value !== currentValue) {
            propertyWillChange(obj, keyName);
            
              if (hasPropertyAccessors) {
                if (
                  (currentValue === undefined && !(keyName in obj)) ||
                  !Object.prototype.propertyIsEnumerable.call(obj, keyName)
                ) {
                  defineProperty(obj, keyName, null, value); // setup mandatory setter
                } else {
                  meta.values[keyName] = value;
                }
              } else {
                obj[keyName] = value;
              }
                        propertyDidChange(obj, keyName);
          }
        } else {
          obj[keyName] = value;
        }
      }
      return value;
    }
function set(obj, keyName, value, tolerant) {
      if (typeof obj === 'string') {
        Ember.assert("Path '" + obj + "' must be global if no obj is given.", IS_GLOBAL.test(obj));
        value = keyName;
        keyName = obj;
        obj = null;
      }

      Ember.assert("Cannot call set with "+ keyName +" key.", !!keyName);

      if (!obj) {
        return setPath(obj, keyName, value, tolerant);
      }

      var meta = obj['__ember_meta__'];
      var desc = meta && meta.descs[keyName];
      var isUnknown, currentValue;

      if (desc === undefined && isPath(keyName)) {
        return setPath(obj, keyName, value, tolerant);
      }

      Ember.assert("You need to provide an object and key to `set`.", !!obj && keyName !== undefined);
      Ember.assert('calling set on destroyed object', !obj.isDestroyed);

      if (desc !== undefined) {
        desc.set(obj, keyName, value);
      } else {

        if (typeof obj === 'object' && obj !== null && value !== undefined && obj[keyName] === value) {
          return value;
        }

        isUnknown = 'object' === typeof obj && !(keyName in obj);

        // setUnknownProperty is called if `obj` is an object,
        // the property does not already exist, and the
        // `setUnknownProperty` method exists on the object
        if (isUnknown && 'function' === typeof obj.setUnknownProperty) {
          obj.setUnknownProperty(keyName, value);
        } else if (meta && meta.watching[keyName] > 0) {
          
            if (hasPropertyAccessors) {
              currentValue = meta.values[keyName];
            } else {
              currentValue = obj[keyName];
            }
                    // only trigger a change if the value has changed
          if (value !== currentValue) {
            propertyWillChange(obj, keyName);
            
              if (hasPropertyAccessors) {
                if (
                  (currentValue === undefined && !(keyName in obj)) ||
                  !Object.prototype.propertyIsEnumerable.call(obj, keyName)
                ) {
                  defineProperty(obj, keyName, null, value); // setup mandatory setter
                } else {
                  meta.values[keyName] = value;
                }
              } else {
                obj[keyName] = value;
              }
                        propertyDidChange(obj, keyName);
          }
        } else {
          obj[keyName] = value;
        }
      }
      return value;
    }
function set ( obj , keyName , value , tolerant ) { if ( typeof obj === 'string' ) { Ember . assert ( "Path '" + obj + "' must be global if no obj is given." , IS_GLOBAL . test ( obj ) ) ; value = keyName ; keyName = obj ; obj = null ; } Ember . assert ( "Cannot call set with " + keyName + " key." , ! ! keyName ) ; if ( ! obj ) { return setPath ( obj , keyName , value , tolerant ) ; } var meta = obj [ '__ember_meta__' ] ; var desc = meta && meta . descs [ keyName ] ; var isUnknown , currentValue ; if ( desc === undefined && isPath ( keyName ) ) { return setPath ( obj , keyName , value , tolerant ) ; } Ember . assert ( "You need to provide an object and key to `set`." , ! ! obj && keyName !== undefined ) ; Ember . assert ( 'calling set on destroyed object' , ! obj . isDestroyed ) ; if ( desc !== undefined ) { desc . set ( obj , keyName , value ) ; } else { if ( typeof obj === 'object' && obj !== null && value !== undefined && obj [ keyName ] === value ) { return value ; } isUnknown = 'object' === typeof obj && ! ( keyName in obj ) ; // setUnknownProperty is called if `obj` is an object, // the property does not already exist, and the // `setUnknownProperty` method exists on the object if ( isUnknown && 'function' === typeof obj . setUnknownProperty ) { obj . setUnknownProperty ( keyName , value ) ; } else if ( meta && meta . watching [ keyName ] > 0 ) { if ( hasPropertyAccessors ) { currentValue = meta . values [ keyName ] ; } else { currentValue = obj [ keyName ] ; } // only trigger a change if the value has changed if ( value !== currentValue ) { propertyWillChange ( obj , keyName ) ; if ( hasPropertyAccessors ) { if ( ( currentValue === undefined && ! ( keyName in obj ) ) || ! Object . prototype . propertyIsEnumerable . call ( obj , keyName ) ) { defineProperty ( obj , keyName , null , value ) ; // setup mandatory setter } else { meta . values [ keyName ] = value ; } } else { obj [ keyName ] = value ; } propertyDidChange ( obj , keyName ) ; } } else { obj [ keyName ] = value ; } } return value ; }
Sets the value of a property on an object, respecting computed properties
and notifying observers and other listeners of the change. If the
property is not defined but the object implements the `setUnknownProperty`
method then that will be invoked as well.

@method set
@for Ember
@param {Object} obj The object to modify.
@param {String} keyName The property key to set
@param {Object} value The value to set
@return {Object} the passed value.
Sets the value of a property on an object respecting computed properties and notifying observers and other listeners of the change . If the property is not defined but the object implements the setUnknownProperty method then that will be invoked as well .