Files
DiceCloud/app/imports/api/creature/creatureProperties/getRootCreatureAncestor.js
2023-10-01 17:30:21 +02:00

9 lines
282 B
JavaScript

import Creatures from '/imports/api/creature/creatures/Creatures';
export default function getRootCreatureAncestor(property) {
if (property.root?.collection !== 'creatures') {
throw 'Property does not have a root ancestor'
}
return Creatures.findOne(property.root.id);
}