gibbon.js
Version:
Actor/Component system for use with pixi.js.
18 lines (13 loc) • 403 B
text/typescript
export type Clonable<T> = {
clone(): T;
}
export type Constructor<T> = { new(...args: any[]): T };
export const isConstructor = <T>(c: any): c is Constructor<T> => {
return (c.constructor !== undefined);
}
/**
* Confirms item contains a clone function.
*/
export const isClonable = <T>(item: any): item is Clonable<T> => {
return typeof (item.clone) === 'function';
}