src/js2dt.js
function convertDefinedFormat (data) {
  if (!(data.type === 'string' && data.format)) {
    return data
  }
  const format = data.format
  delete data.format
  switch (format) {
    case 'date-time':
      data['pattern'] = constants.FORMAT_REGEXPS['date-time']
      break
    case 'email':
      data['pattern'] = constants.FORMAT_REGEXPS['email']
      break
    case 'hostname':
      data['pattern'] = constants.FORMAT_REGEXPS['hostname']
      break
    case 'ipv4':
      data['pattern'] = constants.FORMAT_REGEXPS['ipv4']
      break
    case 'ipv6':
      data['pattern'] = constants.FORMAT_REGEXPS['ipv6']
      break
    case 'uri':
      data['pattern'] = constants.FORMAT_REGEXPS['uri']
      break
    case 'uri-reference':
      data['pattern'] = constants.FORMAT_REGEXPS['uri-reference']
      break
    case 'json-pointer':
      data['pattern'] = constants.FORMAT_REGEXPS['json-pointer']
      break
    case 'uri-template':
      data['pattern'] = constants.FORMAT_REGEXPS['uri-template']
      break
    default:
      data['pattern'] = format
  }
  return data
}
function convertDefinedFormat (data) {
  if (!(data.type === 'string' && data.format)) {
    return data
  }
  const format = data.format
  delete data.format
  switch (format) {
    case 'date-time':
      data['pattern'] = constants.FORMAT_REGEXPS['date-time']
      break
    case 'email':
      data['pattern'] = constants.FORMAT_REGEXPS['email']
      break
    case 'hostname':
      data['pattern'] = constants.FORMAT_REGEXPS['hostname']
      break
    case 'ipv4':
      data['pattern'] = constants.FORMAT_REGEXPS['ipv4']
      break
    case 'ipv6':
      data['pattern'] = constants.FORMAT_REGEXPS['ipv6']
      break
    case 'uri':
      data['pattern'] = constants.FORMAT_REGEXPS['uri']
      break
    case 'uri-reference':
      data['pattern'] = constants.FORMAT_REGEXPS['uri-reference']
      break
    case 'json-pointer':
      data['pattern'] = constants.FORMAT_REGEXPS['json-pointer']
      break
    case 'uri-template':
      data['pattern'] = constants.FORMAT_REGEXPS['uri-template']
      break
    default:
      data['pattern'] = format
  }
  return data
}
function convertDefinedFormat ( data ) { if ( ! ( data . type === 'string' && data . format ) ) { return data } const format = data . format delete data . format switch ( format ) { case 'date-time' : data [ 'pattern' ] = constants . FORMAT_REGEXPS [ 'date-time' ] break case 'email' : data [ 'pattern' ] = constants . FORMAT_REGEXPS [ 'email' ] break case 'hostname' : data [ 'pattern' ] = constants . FORMAT_REGEXPS [ 'hostname' ] break case 'ipv4' : data [ 'pattern' ] = constants . FORMAT_REGEXPS [ 'ipv4' ] break case 'ipv6' : data [ 'pattern' ] = constants . FORMAT_REGEXPS [ 'ipv6' ] break case 'uri' : data [ 'pattern' ] = constants . FORMAT_REGEXPS [ 'uri' ] break case 'uri-reference' : data [ 'pattern' ] = constants . FORMAT_REGEXPS [ 'uri-reference' ] break case 'json-pointer' : data [ 'pattern' ] = constants . FORMAT_REGEXPS [ 'json-pointer' ] break case 'uri-template' : data [ 'pattern' ] = constants . FORMAT_REGEXPS [ 'uri-template' ] break default : data [ 'pattern' ] = format } return data }
Change JSON defined formats to RAML regex.

@param  {Object} data
@returns  {Object}
Change JSON defined formats to RAML regex .