isCloneable
Available since v0.9
Determines if given object is "cloneable". In this context "cloneable" means that an object implements the Cloneable
interface, and offers a clone()
method.
See @aedart/constracts/support/objects/Cloneable
for details.
import { isCloneable } from "@aedart/support/objects";
class A {};
class B {
clone() {
return new this();
}
}
isCloneable(null); // false
isCloneable([]); // false
isCloneable({}); // false
isCloneable(new A()); // false
isCloneable(new B()); // true