Skip to content

Instantly share code, notes, and snippets.

@aerinkim
Last active February 18, 2022 01:22
Show Gist options
  • Save aerinkim/43510f0c8837269e3285eebda55abe22 to your computer and use it in GitHub Desktop.
Save aerinkim/43510f0c8837269e3285eebda55abe22 to your computer and use it in GitHub Desktop.
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