Skip to content

Commit

Permalink
chore: Add ignoreKeys parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
activeguild committed Feb 19, 2024
1 parent fb77810 commit 59863d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export const compareWithBaseFile = (
cachedBaseFile: string[],
prohibitedKeys?: string[],
prohibitedValues?: string[],
ignoreKeysFilter?: (id: unknown) => boolean
ignoreKeysFilter?: (id: unknown) => boolean,
ignoreKeys: RegExp | RegExp[] | undefined
) => {
const errors: string[] = [];
for (let i = 0; i < cachedBaseFile.length; i++) {
Expand All @@ -12,7 +13,8 @@ export const compareWithBaseFile = (
cachedBaseFile[i],
prohibitedKeys,
prohibitedValues,
ignoreKeysFilter
ignoreKeysFilter,
ignoreKeys
);
if (result === true) {
continue;
Expand All @@ -37,7 +39,8 @@ const checkNestedProperty = (
propertyPath: string,
prohibitedKeys?: string[],
prohibitedValues?: string[],
ignoreKeysFilter?: (id: unknown) => boolean
ignoreKeysFilter?: (id: unknown) => boolean,
ignoreKeys?: RegExp | RegExp[] | undefined
):
| {
notFound?: boolean;
Expand All @@ -46,7 +49,7 @@ const checkNestedProperty = (
prohibitedValue?: boolean;
}
| true => {
if (ignoreKeysFilter && ignoreKeysFilter(propertyPath)) {
if (ignoreKeys && ignoreKeysFilter && ignoreKeysFilter(propertyPath)) {
return true;
}
const properties = propertyPath.split(".");
Expand Down
3 changes: 2 additions & 1 deletion src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ parentPort?.on(
cachedBaseFile,
prohibitedKeys,
prohibitedValues,
ignoreKeysFilter
ignoreKeysFilter,
ignoreKeys
);
parentPort?.postMessage({ errors, file });
}
Expand Down

0 comments on commit 59863d1

Please sign in to comment.