isPopulatable
Available since v0.9
Determines if given object is "populatable". Here, "populatable" means that an object implements the Populatable
interface, and offers a populate()
method.
See @aedart/constracts/support/objects/Populatable
for details.
import { isPopulatable } from "@aedart/support/objects";
class A {};
class B {
populate(data) {
// ...not shown here...
return this;
}
}
isPopulatable(null); // false
isPopulatable([]); // false
isPopulatable({}); // false
isPopulatable(new A()); // false
isPopulatable(new B()); // true