(instance: AribtraryObject | Constructor)
| 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? |
| 57 | is.asyncConstructor(instance) ? classOf(instance.class) : |
| 58 | is.Constructor(instance) ? instance as Constructor // is it really a constructor? |
| 59 | : undefined // no, it's a function, but not a constructor |
| 60 | : instance.constructor as Constructor : // it's an object, so get the constructor from the object |
| 61 | undefined; |
| 62 | } |
| 63 | |
| 64 | /** returns true if the instance is an anonymous object (as opposed to constructed via a class) */ |
| 65 | export function isAnonymousObject(instance: any): boolean { |
no test coverage detected