| 45 | } |
| 46 | |
| 47 | export function parentClassOf(instance: AribtraryObject | Constructor): Constructor | undefined { |
| 48 | if (is.nullish(instance)) { |
| 49 | return undefined; |
| 50 | } |
| 51 | const parent = Object.getPrototypeOf(typeof instance === 'function' ? instance : instance.constructor); |
| 52 | return parent.name ? parent : undefined; |
| 53 | } |
| 54 | |
| 55 | export function classOf(instance: AribtraryObject | Constructor): Constructor | undefined { |
| 56 | return instance ? typeof instance === 'function' ? // is it a JavaScript function of some kind? |