Last active
February 18, 2022 06:53
-
-
Save aerinkim/82ac14edb0417caa01f61dce56802770 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const lineItemLabels = ['Item Amount', 'Description', 'Unit Price', 'Unit Quantity']; | |
const lintIssues = [] | |
export function lint(response) { | |
let all_record_annotations = []; | |
if (response.annotations && response.records) { | |
for (const record of response.records) { | |
if(record.annotations) { | |
for (const ann in record.annotations) { | |
all_record_annotations.push(ann.ref); | |
} | |
} | |
} | |
for (const annotation of response.annotations) { | |
if (lineItemLabels.includes(annotation.label){ | |
if(!all_record_annotations.includes(annotation.uuid)){ | |
lintIssues.push({ | |
id: annotation.uuid, | |
label: annotation.label, | |
frame: annotation.page, | |
display: | |
'The label needs to be grouped as part of a line item. Press the G key to group tasks.', | |
}); | |
} | |
} | |
} | |
return { | |
lintIssues, | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment