Remove functional changes

This commit is contained in:
Bjorn Stromberg 2020-06-10 19:57:50 +09:00
parent 9ee6338b23
commit 9c7de4f5af
2 changed files with 14 additions and 22 deletions

View file

@ -66,10 +66,6 @@ const objectTypeNames = [
type ObjectTypeName = typeof objectTypeNames[number];
function isObjectTypeName(name: unknown): name is ObjectTypeName {
return objectTypeNames.includes(name as ObjectTypeName);
}
const primitiveTypeNames = [
'null',
'undefined',
@ -102,14 +98,9 @@ const {toString} = Object.prototype;
const isOfType = <T extends Function | Primitive>(type: string) => (value: unknown): value is T => typeof value === type;
const getObjectType = (value: unknown): ObjectTypeName | undefined => {
const objectTypeName = toString.call(value).slice(8, -1);
if (/HTML\w+Element/.test(objectTypeName) && is.domElement(value)) {
return 'HTMLElement';
}
if (isObjectTypeName(objectTypeName)) {
return objectTypeName;
const objectName = toString.call(value).slice(8, -1);
if (objectName) {
return objectName as ObjectTypeName;
}
return undefined;