lib/record_type/validate.js
function castShorthand (value) {
  var obj

  if (typeof value === 'string') obj = { link: value }
  else if (typeof value === 'function') obj = { type: value }
  else if (Array.isArray(value)) {
    obj = {}

    if (value[1]) obj.inverse = value[1]
    else obj.isArray = true

    // Extract type or link.
    if (Array.isArray(value[0])) {
      obj.isArray = true
      value = value[0][0]
    }
    else value = value[0]

    if (typeof value === 'string') obj.link = value
    else if (typeof value === 'function') obj.type = value
  }
  else return value

  return obj
}
function castShorthand (value) {
  var obj

  if (typeof value === 'string') obj = { link: value }
  else if (typeof value === 'function') obj = { type: value }
  else if (Array.isArray(value)) {
    obj = {}

    if (value[1]) obj.inverse = value[1]
    else obj.isArray = true

    // Extract type or link.
    if (Array.isArray(value[0])) {
      obj.isArray = true
      value = value[0][0]
    }
    else value = value[0]

    if (typeof value === 'string') obj.link = value
    else if (typeof value === 'function') obj.type = value
  }
  else return value

  return obj
}
function castShorthand ( value ) { var obj if ( typeof value === 'string' ) obj = { link : value } else if ( typeof value === 'function' ) obj = { type : value } else if ( Array . isArray ( value ) ) { obj = { } if ( value [ 1 ] ) obj . inverse = value [ 1 ] else obj . isArray = true // Extract type or link. if ( Array . isArray ( value [ 0 ] ) ) { obj . isArray = true value = value [ 0 ] [ 0 ] } else value = value [ 0 ] if ( typeof value === 'string' ) obj . link = value else if ( typeof value === 'function' ) obj . type = value } else return value return obj }
Cast shorthand definition to standard definition.

@param {*} value
@return {Object}
Cast shorthand definition to standard definition .