predictype / predicates/objects / objectPrototypeRelation
objectPrototypeRelation(
source,oper,proto):boolean
Defined in: predicates/objects/objectPrototypeRelation.ts:26
Checks prototype relation between objects (contains_prototype, is_prototype_of).
object
The object to check.
The prototype relation operation to perform (e.g. ‘contains_prototype’, ‘is_prototype_of’).
any
The prototype to compare against.
boolean
True if the relation check is valid according to the operator, otherwise false.
If the operation is not recognized.
const proto = { kind: 'base' };
const source = Object.create(proto);
const target = Object.create(source);
objectPrototypeRelation(source, 'contains_prototype', proto); // true
objectPrototypeRelation(source, 'is_prototype_of', target); // true
Supported Operators: