Skip to content

Commit 1761e48

Browse files
committed
implement wildcards in isOnBlacklist
1 parent ee4eba5 commit 1761e48

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

packages/log/src/LogExport.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type LogHistory from './LogHistory';
33

44
// List of objects to blacklist
55
// '' represents the root object
6+
// * represents a wildcard key
67
export const DEFAULT_PATH_BLACKLIST: string[][] = [
78
['api'],
89
['client'],
@@ -43,7 +44,9 @@ function isOnBlackList(currPath: string[], blacklist: string[][]): boolean {
4344
for (let i = 0; i < blacklist.length; i += 1) {
4445
if (
4546
currPath.length === blacklist[i].length &&
46-
currPath.every((v, index) => v === blacklist[i][index])
47+
currPath.every(
48+
(v, index) => blacklist[i][index] === '*' || v === blacklist[i][index]
49+
)
4750
) {
4851
// blacklist match
4952
return true;
@@ -150,7 +153,7 @@ function formatDate(date: Date): string {
150153
* @param logHistory Log history to include in the console.txt file
151154
* @param metadata Additional metadata to include in the metadata.json file
152155
* @param reduxData Redux data to include in the redux.json file
153-
* @param blacklist List of JSON paths to blacklist in redux data. A JSON path is a list representing the path to that value (e.g. client.data would be `['client', 'data']`)
156+
* @param blacklist List of JSON paths to blacklist in redux data. A JSON path is a list representing the path to that value (e.g. client.data would be `['client', 'data']`). Wildcards (*) are accepted in the path.
154157
* @param fileNamePrefix The zip file name without the .zip extension. Ex: test will be saved as test.zip
155158
* @returns A promise that resolves successfully if the log archive is created and downloaded successfully, rejected if there's an error
156159
*/

0 commit comments

Comments
 (0)