Skip to content

Commit

Permalink
refactor(extract-method): move duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
gregswindle committed Feb 18, 2018
1 parent 7411db8 commit 259df3a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/crc/crc-responsibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ const getPrimaryDescription =
""
);

const getDescriptionsFromTags = (comments) => {
const pullAllTags = (comments) => {
const comment = comments.find((cmt) => {
const tags = get(cmt, "tags", []);
return tags.find((tag) => doctrineOpts.descriptions.includes(tag.title));
});
const tags = get(comment, "tags", []);
return get(comment, "tags", []);
};

const getDescriptionsFromTags = (comments) => {
const tags = pullAllTags(comments);
return pull(tags.map((tag) => get(tag, "description", null)), null);
};

const getDescriptionFromTags = (comments) => {
const comment = comments.find((cmt) => {
const tags = get(cmt, "tags", []);
return tags.find((tag) => doctrineOpts.descriptions.includes(tag.title));
});
const tags = get(comment, "tags", []);
const tags = pullAllTags(comments);
return get(first(tags), "description");
};

Expand Down

0 comments on commit 259df3a

Please sign in to comment.