Define immutable properties on a target object

@param {Object} target - An object to be extended
@param {Object} values - An object of properties
@return {Object} The target object
978046
function defineImmutable(target, values) {
    Object.keys(values).forEach(function(key){
      Object.defineProperty(target, key, {
        configurable: false,
        enumerable: true,
        value: values[key]
      });
    });
    return target;
  }
314280
function(key, target, source) {
		var tval = target[key];
		var sval = source[key];

		if (helpers.isObject(tval) && helpers.isObject(sval)) {
			helpers.mergeIf(tval, sval);
		} else if (!target.hasOwnProperty(key)) {
			target[key] = helpers.clone(sval);
		}
	}
1159711
function (target, source) {
				getOwnPropertyNames(source).forEach(function (key) {
					defineProperty(
						target,
						key,
						getOwnPropertyDescriptor(source, key)
					);
				});
				return target;
			}
1123370
function modifyTarget(target, source, sourceKeys, filters, overrideKeys) {

    // Arguments available to each filter.
    var filterContext = {
        target: target, // readonly
        source: source, // readonly
        sourceKey: null, // readonly
        targetKey: null,
        sourceValue: null
    };

    // For each property, send it through the filter pipeline and
    // then apply it to the target object.
    for (var sourceKey in sourceKeys) {
        filterContext.sourceKey = sourceKey;
        filterContext.targetKey = sourceKeys[sourceKey];

        // Throw an error if the source property name doesn't refer to a value.
        if (!(sourceKey in source)) {
            errorManager.propertyNotFound(sourceKey, source);
        }
        filterContext.sourceValue = source[sourceKey];

        // Apply the filters to the property.
        for (var i = 0; i < filters.length; i++) {
            if (!filters[i](filterContext)) {
                // Don't apply this property to the target.
                filterContext.targetKey = null;
                break;
            }
        }

        // Apply property to target.
        if (filterContext.targetKey !== null) {
            // Allow overwrite to take place. Developer can ignore error.
            var overwritten = filterContext.targetKey in target;

            target[filterContext.targetKey] = filterContext.sourceValue;

            if (overwritten && !overrideKeys[sourceKey]) {
                errorManager.propertyOverride(filterContext.targetKey, target);
            }
        }
    }
}
157542
function defineProp(target, obj, prop) {
  if (Object.defineProperty) {
    Object.defineProperty(target, prop, {
      get: function() { return obj[prop]; }
    });
  }
}
886142
function immutable(/* a[, b[, ...]] */)
{
  // invoke mutable with new object as first argument
  var args = Array.prototype.slice.call(arguments, 0);
  // use `undefined` as always-override value
  return mutable.apply(this, [undefined].concat(args));
}
1039562
function _props (opts, source, target) {
  let idx = opts.visited.indexOf(source) // check for circularities
  if (idx === -1) {
    opts.visited.push(source)
    opts.cloned.push(target)
    Object.getOwnPropertyNames(source).forEach(function (key) {
      if (key === 'prototype') {
        target[key] = Object.create(source[key])
        Object.getOwnPropertyNames(source[key]).forEach(function (p) {
          if (p !== 'constructor') {
            _descriptor(opts, source[key], target[key], p)
            // } else {
            //   target[key][p] = target
            //   Safari may throw here with TypeError: Attempted to assign to readonly property.
          }
        })
      } else {
        _descriptor(opts, source, target, key)
      }
    })
    opts.visited.pop()
    opts.cloned.pop()
  } else {
    target = opts.cloned[idx] // add reference of circularity
  }
  return target
}
1263972
function baseAssignValue(object, key, value) {
  if (key == '__proto__' && _defineProperty) {
    _defineProperty(object, key, {
      'configurable': true,
      'enumerable': true,
      'value': value,
      'writable': true
    });
  } else {
    object[key] = value;
  }
}
1014536
public static <K, V> ImmutableSetMultimap<K, V> indexToSetMultimapWithMultipleKeys(
      Iterable<? extends V> values, Function<? super V, ? extends Collection<? extends K>> keyFunction) {
    final ImmutableSetMultimap.Builder<K,V> ret = ImmutableSetMultimap.builder();

    for (final V value : values) {
      // nulls banned by contract
      //noinspection ConstantConditions
      for (K key : keyFunction.apply(value)) {
        ret.put(key, value);
      }
    }

    return ret.build();
  }
336278
function ( obj, type ) {
		var target = obj.prototype || obj;

		utility.iterate( prototypes[type], function ( v, k ) {
			if ( !target[k] ) {
				utility.property( target, k, {value: v, configurable: true, writable: true} );
			}
		});

		return obj;
	}
1251881
function defineObservableProperty(target, property, originalValue) {

        //we store the value in an non-enumerable property with generated unique name
        var internalPropName = '_' + (uidCounter++) + property;

        if (target.hasOwnProperty(property)) {
            Object.defineProperty(target, internalPropName, {
                value: originalValue,
                writable: true,
                enumerable: false,
                configurable: true
            });
        }

        //then we create accessor method for our 'hidden' property,
        // that dispatch changesRecords when the value is updated
        Object.defineProperty(target, property, {
            get: function () {
                return this[internalPropName];
            },
            set: function (value) {
                if (!sameValue(value, this[internalPropName])) {
                    var oldValue = this[internalPropName];
                    Object.defineProperty(this, internalPropName, {
                        value: value,
                        writable: true,
                        enumerable: false,
                        configurable: true
                    });
                    var notifier = Object.getNotifier(this);
                    notifier.notify({ type: 'update', name: property, oldValue: oldValue });
                }
            },
            enumerable: true,
            configurable: true
        });
    }
946847
function set(values) {
    var s = this;

    if (arguments.length === 2) {
      values = {};
      var key = arguments[0];
      values[key] = arguments[1];
    }

    Object.assign(s, values);
    return s;
  }
1260842
function copyOwnProperties(source, target, ignorePropertyNames = []) {
  Object.getOwnPropertyNames(source).forEach(name => {
    if (ignorePropertyNames.indexOf(name) < 0) {
      const descriptor = Object.getOwnPropertyDescriptor(source, name);
      Object.defineProperty(target, name, descriptor);
    }
  });
  return target;
}
1171055
function(target){
            // skip valid type check if value evaluating to false or empty array.
            if(!this.validTypes || !this.validTypes.length){
                return true;
            }

            for(var i = this.validTypes.length - 1; i >= 0; i--){
                var type = this.validTypes[i];
                if(target instanceof type){
                    return true;
                }
            }

            // no valid type match found
            return false;
        }
1169943
function defineConstants(target, properties, options) {
  return defineProperties(target, properties, {
    writable: false,
    configurable: false,
    enumerable: options && options.enumerable
  });
}
822768
function defineProperties(target, options/*, source, ...*/)
	{
		if (options == null)
			options = {};

		var i = 2,
			max = arguments.length,
			source, prop;

		for (; i < max; ++i)
		{
			source = arguments[i];
			if (!(source instanceof Object))
				continue;

			for (prop in source)
			{
				if (source[prop] == null)
					continue;

				defineProperty(target, prop, {
					value: source[prop],
					enumerable: options.enumerable == null ? true : !!options.enumerable,
					writable: options.writable == null ? true : !!options.writable,
					configurable: options.configurable == null ? true : !!options.configurable
				});
			}
		}

		return target;
	}
703861
function (target, props) {
		$.extend(target, props);
		for (var name in props) {
			if (props[name] === null || props[name] === undefined) {
				target[name] = props[name];
			}
		}
		return target;
	}