Validate and merge new data based on the stored schema.

@param {...*} newData Data to validate, merge and return. If no data is
given, a variable containing any default values, if configured,
will be returned.

@returns {*} Validated and merged data
423424
function () {
    return validateData.apply(this, [this.options,
        undefined].concat(Array.prototype.slice.call(arguments)));
  }
874965
public function mergeData(array $data)
    {
        $args = func_get_args();
        foreach ($args as $key => $v) {
            if (is_array($v)) {
                $this->data = array_merge($this->data, $v);
            }
        }
    }
1092021
function (newData) {
            var result = new $.Deferred();
            var path = this.path;
            var prefFile = FileSystem.getFileForPath(path);

            if (path) {
                try {
                    var text = JSON.stringify(newData, null, 4);

                    // maintain the original line endings
                    text = FileUtils.translateLineEndings(text, this._lineEndings);
                    prefFile.write(text, {}, function (err) {
                        if (err) {
                            result.reject("Unable to save prefs at " + path + " " + err);
                        } else {
                            result.resolve();
                        }
                    });
                } catch (e) {
                    result.reject("Unable to convert prefs to JSON" + e.toString());
                }
            } else {
                result.resolve();
            }
            return result.promise();
        }
360587
function union(schema, defaults, options) {
  if (kindOf(schema) !== 'array') {
    if (process.env.NODE_ENV !== 'production') {
      throw new Error(
        `Union structs must be defined as an array, but you passed: ${schema}`
      )
    } else {
      throw new Error(`Invalid schema: ${schema}`)
    }
  }

  const kinds = schema.map(s => any(s, undefined, options))
  const name = 'union'
  const type = kinds.map(k => k.type).join(' | ')
  const validate = (value = resolveDefaults(defaults)) => {
    const errors = []

    for (const k of kinds) {
      const [e, r] = k.validate(value)

      if (!e) {
        return [undefined, r]
      }

      errors.push(e)
    }
    errors[0].type = type
    return errors
  }

  return new Kind(name, type, validate)
}
647664
function (data, isMerge) {
        if (isMerge === true) {
            deepMerge(conf, data);
        } else {
            conf = JSON.parse(JSON.stringify(data || {}))
        }
    }
393040
function merge(_old, _new) {
        for (var i in _new) {
            if (_new.hasOwnProperty(i)) {
                _old[i] = _new[i];
            }
        }
        return _old;
    }
518479
function normalizeStyleData (data: VNodeData): ?Object {
  const style = normalizeStyleBinding(data.style)
  // static style is pre-processed into an object during compilation
  // and is always a fresh object, so it's safe to merge into it
  return data.staticStyle
    ? extend(data.staticStyle, style)
    : style
}
566057
def level=(new_val)
      return nil if @level == new_val
      raise JSS::InvalidDataError, "New value must be one of '#{LEVELS.join("' '")}'" unless LEVELS.include? new_val
      @level = new_val
      @need_to_update = true
    end
720709
function (data, merge) {
            this.json.inject(data, this._data, merge);
            if (this._dataBeanName) {
                if (!ariaCoreJsonValidator.normalize({
                    json : this._data,
                    beanName : this._dataBeanName
                })) {
                    this.$logError(this.DATA_CONTENT_INVALID, [this._dataBeanName, this.$classpath]);
                }
            }
        }
1350273
function validateDataSource(connections, dataSource, cb) {
  var dataSourceToValidate = _.clone(dataSource);
  var DataSource = models.get(connections.mongooseConnection, models.MODELNAMES.DATA_SOURCE);

  //Expect The Data Source To Have Data
  var failure = validate(dataSourceToValidate).has(CONSTANTS.DATA_SOURCE_DATA);

  if (failure) {
    return cb(buildErrorResponse({
      error: new Error("No Data Passed To Validate"),
      code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS
    }));
  }

  //Generate A Hash
  var hash = misc.generateHash(dataSourceToValidate.data);

  //Populate A Cache Object
  //LastRefreshed is populated just for the cache mongoose schema
  var cache = {
    dataHash: hash,
    currentStatus: {
      status: "ok"
    },
    data: dataSourceToValidate.data,
    lastRefreshed: new Date().getTime(),
    updateTimestamp: new Date().getTime()
  };

  dataSourceToValidate.cache = [cache];

  //Create A New Mongoose. Note that this document is never saved. It is useful for consistent validation
  var testDataSource = new DataSource(dataSourceToValidate);
  //Validating Without Saving
  testDataSource.validate(function(err) {
    var valid = err ? false : true;
    var dataSourceJSON = testDataSource.toJSON();

    dataSourceJSON = processDataSourceResponse(dataSourceJSON);

    dataSourceJSON = _.omit(dataSourceJSON, "lastRefreshed", "currentStatus", "updateTimestamp", CONSTANTS.DATA_SOURCE_ID);

    dataSourceJSON.validationResult = {
      valid: valid,
      message: valid ? "Data Source Is Valid" : "Invalid Data Source Update Data."
    };

    return cb(undefined, dataSourceJSON);
  });
}
80158
function createFromData(data, container) {
  if (data === undefined) {
    return Promise.resolve([])
  }

  if (!(isObject(data) || Array.isArray(data))) {
    return Promise.reject(new Error('Invalid animation data'))
  }
  return Promise.resolve(create(data, container))
}
598266
def NewData(self, text):
        '''
        
        '''
        sint = ignore_exception(ValueError)(int)
        if len(self.tags) > 0:
            if self.tags[-1] == "beat-type" or self.tags[-1] == "beats":
                if sint(text) is int:
                    self.chars[self.tags[-1]] = text

        if self.validateData(text):
            if len(self.tags) > 0:
                if self.tags[-1] not in self.chars:
                    self.chars[self.tags[-1]] = text
                else:
                    self.chars[self.tags[-1]] += text
1191964
def MergeData(self, merge_data, raw_data=None):
    """"""
    self.FlushCache()
    if raw_data is None:
      raw_data = self.raw_data

    for k, v in iteritems(merge_data):
      # A context clause.
      if isinstance(v, dict) and k not in self.type_infos:
        if k not in self.valid_contexts:
          raise InvalidContextError("Invalid context specified: %s" % k)
        context_data = raw_data.setdefault(k, collections.OrderedDict())
        self.MergeData(v, context_data)

      else:
        # Find the descriptor for this field.
        descriptor = self.type_infos.get(k)
        if descriptor is None:
          msg = ("Missing config definition for %s. This option is likely "
                 "deprecated or renamed. Check the release notes." % k)
          if flags.FLAGS.disallow_missing_config_definitions:
            raise MissingConfigDefinitionError(msg)

        if isinstance(v, string_types):
          v = v.strip()

        # If we are already initialized and someone tries to modify a constant
        # value (e.g. via Set()), break loudly.
        if self.initialized and k in self.constants:
          raise ConstModificationError(
              "Attempting to modify constant value %s" % k)

        raw_data[k] = v
944423
function _mapDataValue(data, nestedSchema) {
    if (typeof nestedSchema === 'function') {
        return nestedSchema.apply(data);
    } else if (typeof nestedSchema === 'object') {
        return _map(data, nestedSchema);
    } else {
        return _getDataValue(data, nestedSchema);
    }
}
416585
protected final function validateNewData(array $data = null) {
		if ($data === null && isset($this->_formData)) {
			$data = $this->_formData;
		}
		if ($this->rules) {
			return $this->validateData($this->rules, $data);
		}

		return true;
	}
1150163
function (data) {
            // Convert string to WordArray, else assume WordArray already
            if (typeof data == 'string') {
                data = Utf8.parse(data);
            }

            // Append
            this._data.concat(data);
            this._nDataBytes += data.sigBytes;
        }
1278842
def data_type=(new_val)
      return nil if @data_type == new_val
      raise JSS::InvalidDataError, "data_type must be a string, one of: #{DATA_TYPES.join(', ')}" unless DATA_TYPES.include? new_val
      @data_type = new_val
      @need_to_update = true
    end