lib/transformType.js
function findType (type) {
  let name = ''
  const defaultTypes = [
    'string',
    'number',
    'boolean',
    'symbol',
    'array',
    'object'
  ]

  try {
    name = type.prototype.constructor.name.toLowerCase()
  } catch (err) {}

  if (defaultTypes.includes(name)) {
    return types[name]()
  }

  return value => {
    if (!(value instanceof type)) {
      throw new Error(`is not instance of ${type.prototype.constructor.name}`)
    }

    return true
  }
}
function findType (type) {
  let name = ''
  const defaultTypes = [
    'string',
    'number',
    'boolean',
    'symbol',
    'array',
    'object'
  ]

  try {
    name = type.prototype.constructor.name.toLowerCase()
  } catch (err) {}

  if (defaultTypes.includes(name)) {
    return types[name]()
  }

  return value => {
    if (!(value instanceof type)) {
      throw new Error(`is not instance of ${type.prototype.constructor.name}`)
    }

    return true
  }
}
function findType ( type ) { let name = '' const defaultTypes = [ 'string' , 'number' , 'boolean' , 'symbol' , 'array' , 'object' ] try { name = type . prototype . constructor . name . toLowerCase ( ) } catch ( err ) { } if ( defaultTypes . includes ( name ) ) { return types [ name ] ( ) } return value => { if ( ! ( value instanceof type ) ) { throw new Error ( ` ${ type . prototype . constructor . name } ` ) } return true } }
Find validator fucntion for a type
@param  {Function} type
@return {Function}
Find validator fucntion for a type