UNPKG

@blynx/inject

Version:
8 lines (7 loc) 297 B
import { NameProperty } from "./constants"; export function getName(target) { if (typeof target === 'object') { return target.toString().match(/^\[object\s([^\s\]]+)\]/)[1]; } return target[NameProperty] || target.name || target.toString().match(/^function\s*([^\s(]+)/)[1]; }