UNPKG

@jable/inject

Version:

Inject dependencies into injectable classes

8 lines (7 loc) 304 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]; }