mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2447] Added review checker tool (#3039)
This commit is contained in:
committed by
Eugenio Romano
parent
e37eb3c7cb
commit
4b9daeb1c8
31
lib/config/DocProcessor/stoplist.ts
Normal file
31
lib/config/DocProcessor/stoplist.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import * as fs from "fs";
|
||||
|
||||
/* "Stoplist" of regular expressions to match against strings. */
|
||||
export class Stoplist {
|
||||
regexes: RegExp[];
|
||||
|
||||
constructor(slFilePath: string) {
|
||||
let listExpressions = JSON.parse(fs.readFileSync(slFilePath, 'utf8'));
|
||||
this.regexes = [];
|
||||
|
||||
if (listExpressions) {
|
||||
for (var i = 0; i < listExpressions.length; i++) {
|
||||
this.regexes.push(new RegExp(listExpressions[i]));
|
||||
}
|
||||
} else {
|
||||
this.regexes = [];
|
||||
}
|
||||
}
|
||||
|
||||
// Check if an item is covered by the stoplist and reject it if so.
|
||||
isRejected(itemName: string) {
|
||||
for (var i = 0; i < this.regexes.length; i++) {
|
||||
if (this.regexes[i].test(itemName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user