From c20141b366cd28f0e1f9ba6dacb7171d02767f26 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Fri, 10 Nov 2017 16:05:32 +0100 Subject: [PATCH] Ensure getObjectType is defined before first use --- source/index.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/index.ts b/source/index.ts index 15031f7..d6d6368 100644 --- a/source/index.ts +++ b/source/index.ts @@ -34,11 +34,6 @@ export enum TypeName { const toString = Object.prototype.toString; const isOfType = (type: string) => (value: any) => typeof value === type; // tslint:disable-line:strict-type-predicates -const isObjectOfType = (typeName: string | TypeName) => (value: any) => { - const type = typeName === 'string' ? TypeName[typeName] : typeName; - - return getObjectType(value) === type; -}; const getObjectType = (value: any): TypeName | null => { const objectName = toString.call(value).slice(8, -1) as string; @@ -87,6 +82,12 @@ const getObjectType = (value: any): TypeName | null => { } }; +const isObjectOfType = (typeName: string | TypeName) => (value: any) => { + const type = typeName === 'string' ? TypeName[typeName] : typeName; + + return getObjectType(value) === type; +}; + function is(value: any): TypeName { // tslint:disable-line:only-arrow-functions if (value === null) { return TypeName.null;