MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / splitComparisonFields

Function splitComparisonFields

src/utils/logEmbeds.js:48–64  ·  view source on GitHub ↗
(fields = [])

Source from the content-addressed store, hash-verified

46}
47
48export function splitComparisonFields(fields = []) {
49 const comparison = { before: null, after: null, rest: [] };
50
51 for (const field of fields) {
52 const label = stripFieldLabel(field.name).toLowerCase();
53
54 if (/^old|^before/.test(label)) {
55 comparison.before = field.value;
56 } else if (/^new|^after/.test(label)) {
57 comparison.after = field.value;
58 } else {
59 comparison.rest.push(field);
60 }
61 }
62
63 return comparison;
64}
65
66export function applyLogFooter(embed, { guild, executorId, executorTag, executorAvatar, footerText } = {}) {
67 if (footerText) {

Callers 1

createLogEmbedFunction · 0.90

Calls 1

stripFieldLabelFunction · 0.85

Tested by

no test coverage detected