UNPKG

@npmstuff/argdown-core

Version:

A pluggable parser for the Argdown argumentation syntax

35 lines 1.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.relationMemberIsInSelection = exports.otherRelationMemberIsInSelection = void 0; const model_1 = require("../model/model"); const utils_1 = require("../utils"); const otherRelationMemberIsInSelection = (relation, relationMember, selectedStatements, selectedArguments) => { return (0, exports.relationMemberIsInSelection)(relation, (0, utils_1.other)(relation, relationMember), selectedStatements, selectedArguments); }; exports.otherRelationMemberIsInSelection = otherRelationMemberIsInSelection; const relationMemberIsInSelection = (relation, relationMember, selectedStatements, selectedArguments) => { if (relationMember.type === model_1.ArgdownTypes.EQUIVALENCE_CLASS) { if (selectedStatements.get(relationMember.title)) { return true; } const isSymmetric = model_1.IRelation.isSymmetric(relation); let role = model_1.StatementRole.MAIN_CONCLUSION; if (relation.to === relationMember) { role = model_1.StatementRole.PREMISE; } return (undefined !== relationMember.members.find(s => (isSymmetric || s.role === role) && selectedArguments.get(s.argumentTitle) !== undefined)); } else if (relationMember.type === model_1.ArgdownTypes.ARGUMENT && selectedArguments.get(relationMember.title)) { return true; } else if (relationMember.type === model_1.ArgdownTypes.INFERENCE && selectedArguments.get(relationMember.argumentTitle)) { return true; } return false; }; exports.relationMemberIsInSelection = relationMemberIsInSelection; //# sourceMappingURL=selectionUtils.js.map