lib/recordCheck/data-check-string-email.js
function createCheckDefaultValue(fieldDefinition, fieldName) {
  const defaultValue = fieldDefinition.defaultValue;

  // -----------------------------------------------------------------------
  // Set default value
  // -----------------------------------------------------------------------
  return function (content) {

    const valueToCheck = content[fieldName];
    // If the value is defined, we need to check it
    if (valueToCheck === undefined || valueToCheck === null) {
      if (defaultValue !== undefined) {
        content[fieldName] = defaultValue;
      }
    } else {
      if (Array.isArray(valueToCheck)) {
        valueToCheck.forEach(function (item, idx, arr) {
          if (item === undefined || item === null) {
            arr[idx] = defaultValue;
          }
        });
      }
    }
  };
}
function createCheckDefaultValue(fieldDefinition, fieldName) {
  const defaultValue = fieldDefinition.defaultValue;

  // -----------------------------------------------------------------------
  // Set default value
  // -----------------------------------------------------------------------
  return function (content) {

    const valueToCheck = content[fieldName];
    // If the value is defined, we need to check it
    if (valueToCheck === undefined || valueToCheck === null) {
      if (defaultValue !== undefined) {
        content[fieldName] = defaultValue;
      }
    } else {
      if (Array.isArray(valueToCheck)) {
        valueToCheck.forEach(function (item, idx, arr) {
          if (item === undefined || item === null) {
            arr[idx] = defaultValue;
          }
        });
      }
    }
  };
}
function createCheckDefaultValue ( fieldDefinition , fieldName ) { const defaultValue = fieldDefinition . defaultValue ; // ----------------------------------------------------------------------- // Set default value // ----------------------------------------------------------------------- return function ( content ) { const valueToCheck = content [ fieldName ] ; // If the value is defined, we need to check it if ( valueToCheck === undefined || valueToCheck === null ) { if ( defaultValue !== undefined ) { content [ fieldName ] = defaultValue ; } } else { if ( Array . isArray ( valueToCheck ) ) { valueToCheck . forEach ( function ( item , idx , arr ) { if ( item === undefined || item === null ) { arr [ idx ] = defaultValue ; } } ) ; } } } ; }
Set the default value if no value is there
@param fieldDefinition The field_definition for this field.
@param fieldName The name of the current field
@return checks A list of checks to be perfomred
Set the default value if no value is there