Skip to content

Commit e187ff8

Browse files
docs(redact-wasm): add JSDocs (#4844)
Related-to: GH-4741. Related-to: GH-3327.
1 parent b6b14bb commit e187ff8

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

redact-wasm/index.ts

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ async function moduleFromPath(path: string): Promise<WebAssembly.Module> {
2929
throw new Error(`Unknown path: ${path}`);
3030
}
3131

32+
/**
33+
* Initialize the WebAssembly.
34+
*
35+
* @param detect
36+
* Custom detection function.
37+
* @param replace
38+
* Custom replacement function.
39+
* @returns
40+
* Promise to the initialized WebAssembly instance.
41+
*/
3242
export async function initializeWasm(
3343
detect: CustomDetect,
3444
replace: CustomRedact,
@@ -48,12 +58,29 @@ export async function initializeWasm(
4858
}
4959
}
5060

51-
type CustomDetect = typeof ArcjetRedactCustomRedact.detectSensitiveInfo;
52-
type CustomRedact = typeof ArcjetRedactCustomRedact.redactSensitiveInfo;
61+
/**
62+
* Detect sensitive info.
63+
*
64+
* @param tokens
65+
* Tokens to detect in.
66+
* @returns
67+
* Array of detected entities.
68+
*/
69+
export type CustomDetect = typeof ArcjetRedactCustomRedact.detectSensitiveInfo;
70+
71+
/**
72+
* Redact sensitive info.
73+
*
74+
* @param entityType
75+
* Entity to redact.
76+
* @param plaintext
77+
* The plaintext string to redact.
78+
* @returns
79+
* Redacted string.
80+
*/
81+
export type CustomRedact = typeof ArcjetRedactCustomRedact.redactSensitiveInfo;
5382

5483
export {
55-
type CustomDetect,
56-
type CustomRedact,
5784
type RedactedSensitiveInfoEntity,
5885
type RedactSensitiveInfoConfig,
5986
type SensitiveInfoEntity,

0 commit comments

Comments
 (0)