Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

check if value is a class nodejs

export const isClass = <T>(value: unknown): value is Constructor<T> => {
	return typeof value === "function" && typeof value.prototype === "object";
};

export type Constructor<T> = new (...args: unknown[]) => T;
Source by www.javascripttutorial.net #
 
PREVIOUS NEXT
Tagged: #check #class #nodejs
ADD COMMENT
Topic
Name
9+2 =