detect type using typeMap
423312
function type(input) {

  //If the input value is null, undefined or NaN the toStringTypes object shouldn't be used
  if (input === null || input === undefined || (input !== input && String(input) === "NaN")) {
    return String(input);
  }

  // use the typeMap to detect the type and fallback to object if the type wasn't found
  return typeMap[Object.prototype.toString.call(input)] || "object";
}
809704
def type_string(self):
        """"""
        if self.is_tuple:
            subtypes = [item.type_string for item in self.children]
            return '{}({})'.format(
                '' if self.val_guaranteed else '*',
                ', '.join(subtypes))
        elif self.is_list:
            return '{}[{}]'.format(
                '' if self.val_guaranteed else '*',
                self.children[0].type_string)
        else:
            return '{}{}'.format(
                '' if self.val_guaranteed else '*',
                self.type_.__name__)
759565
def match_type(mtype, patterns):
    ''''''
    for p in patterns:
        if fnmatch.fnmatch(mtype, p):
            return True
    return False
897297
function isTypeOf(path, typePath) {
            var node = _getNode(path);

            if (node) {
                return state.core.isTypeOf(node, typePath);
            }

            return false;
        }
860595
private void handleTypeAndAttributes(Node node, Map<String, Object> elementMap) {
        // Set type
        if (node.getLocalName() != null) {
            elementMap.put("_type", node.getLocalName());
        }

        // Set the attributes
        if (node.getAttributes() != null) {
            NamedNodeMap attributeMap = node.getAttributes();
            for (int i = 0; i < attributeMap.getLength(); i++) {
                Node attribute = attributeMap.item(i);
                elementMap.put(attribute.getNodeName(), attribute.getNodeValue());
            }
        }
    }
574539
function match(args, typeMap) {
  // No arguments, no win.
  if (!args || !args.length) {
    throw new Error('Cannot perform overload.match: args must be non-null array');
  } else if (!typeMap || !typeMap.length) {
    // We always satisfy a null or empty typeMap
    return true;
  }

  // Validate the arguments one by one
  for (let index = 0; index < args.length; index++) {
    if (!compatible(args[index], typeMap[index])) {
      return false;
    }
  }

  // If not incompatible, sucess
  return true;
}
59986
def guess_type(typ):
    ''''''
    # Strip useless numbers
    match = re.match("([a-zA-Z]+)\d*", typ)
    if match:
        typ = match.groups()[0]
        return typ
910093
def mapped_type(self, tchain, p_elem):
        """"""
        SchemaNode("data", p_elem).set_attr("type",
                                            self.datatype_map[tchain[0].arg])
698385
def find_type(cls, val):
        
        mt = ""
        index = val.rfind(".")
        if index == -1:
            val = "fake.{}".format(val)
        elif index == 0:
            val = "fake{}".format(val)

        mt = mimetypes.guess_type(val)[0]
        if mt is None:
            mt = ""

        return mt
365727
@SuppressWarnings("unchecked")
    private String getEsType(ESMapping mapping, String fieldName) {
        String key = mapping.get_index() + "-" + mapping.get_type();
        Map<String, String> fieldType = esFieldTypes.get(key);
        if (fieldType == null) {
            ImmutableOpenMap<String, MappingMetaData> mappings;
            try {
                mappings = transportClient.admin()
                    .cluster()
                    .prepareState()
                    .execute()
                    .actionGet()
                    .getState()
                    .getMetaData()
                    .getIndices()
                    .get(mapping.get_index())
                    .getMappings();
            } catch (NullPointerException e) {
                throw new IllegalArgumentException("Not found the mapping info of index: " + mapping.get_index());
            }
            MappingMetaData mappingMetaData = mappings.get(mapping.get_type());
            if (mappingMetaData == null) {
                throw new IllegalArgumentException("Not found the mapping info of index: " + mapping.get_index());
            }

            fieldType = new LinkedHashMap<>();

            Map<String, Object> sourceMap = mappingMetaData.getSourceAsMap();
            Map<String, Object> esMapping = (Map<String, Object>) sourceMap.get("properties");
            for (Map.Entry<String, Object> entry : esMapping.entrySet()) {
                Map<String, Object> value = (Map<String, Object>) entry.getValue();
                if (value.containsKey("properties")) {
                    fieldType.put(entry.getKey(), "object");
                } else {
                    fieldType.put(entry.getKey(), (String) value.get("type"));
                }
            }
            esFieldTypes.put(key, fieldType);
        }

        return fieldType.get(fieldName);
    }
1232556
def match_type?(object)
            result = object.kind_of_any? self.type_classes
            if not result
                result = object.type_of_any? self.type_types
            end
            
            return result
        end
248243
public static <K, V> TypeChecker<Map<? extends K, ? extends V>> tMap(Class<? extends K> keyType, Class<? extends V> valueType) {
        return tMap(tSimple(keyType), tSimple(valueType));
    }
895279
function determineType(obj) {
    var type;
    var typeValue;
    var name;

    if (value(obj).typeOf(Object)) {
        type = obj.type || "Object";
    } else {
        type = obj;
    }

    typeValue = value(type);

    if (typeValue.typeOf(String)) {
        name = type.charAt(0).toUpperCase() + type.substring(1);
        return supportedTypes.indexOf(name) === -1 ? "String" : name;
    } else if (typeValue.typeOf(Function)) {
        name = type.toString().match(fnName)[1];
    } else if (typeValue.typeOf(Object)) {
        if (type.type) {
            name = type.type;
        } else {
            return "Object";
        }
    } else {
        name = type.constructor.toString().match(fnName)[1];
    }

    if (supportedTypes.indexOf(name) === -1) {
        throw new TypeError("Type '" + name + "' is not supported");
    }

    return name;
}
226423
function mapArray(type) {
		return Array.map(type, function(thing) {
			return isType(thing) ? parse(thing) : thing;
		});
	}
1073455
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
  }
}
831262
function checkType(value, type) {
  if (typeof type === 'string') {
    switch (type) {
      case 'string':
      case 'object':
      case 'number':
      case 'boolean':
      case 'function':
        return typeof value === type;
      case 'class':
        return typeof value === 'function';
      case 'array':
        return value.constructor === Array;
      default:
        return false;
    }
  }
  else {
    return value instanceof type;
  }
}
608252
public boolean shouldShowType(String contextKey, String typeName) {

        Map<String, CmsDefaultSet<String>> allowedContextMap = safeGetAllowedContextMap();
        CmsDefaultSet<String> allowedContexts = allowedContextMap.get(typeName);
        if (allowedContexts == null) {
            return true;
        }
        return allowedContexts.contains(contextKey);
    }