aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/toType.js
blob: 9df6c02a456f031284e553ed321caf3393c78463 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import { class2type } from "../var/class2type.js";
import { toString } from "../var/toString.js";

export function toType( obj ) {
	if ( obj == null ) {
		return obj + "";
	}

	return typeof obj === "object" ?
		class2type[ toString.call( obj ) ] || "object" :
		typeof obj;
}