Last active
February 18, 2022 01:22
-
-
Save aerinkim/43510f0c8837269e3285eebda55abe22 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 REGEX_contains_hashtag = /[#]/; | |
const labelsToCheck = ['Invoice Number']; | |
export function lint(response) { | |
const lintIssues = []; | |
if (response.annotations) { | |
for (const annotation of response.annotations) { | |
if (labelsToCheck.includes(annotation.label)) { | |
if (REGEX_contains_hashtag.test(annotation.text)) { | |
lintIssues.push({ | |
id: annotation.uuid, | |
label: annotation.label, | |
frame: annotation.page, | |
display: | |
'Invoice Number should not contain hashtag.', | |
}); | |
} | |
} | |
} | |
} | |
return { | |
lintIssues, | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment