( settings: unknown, secretOptionNames: ReadonlySet<string> | null | undefined, options?: UserScriptSecretSanitizerOptions, )
| 872 | } |
| 873 | |
| 874 | function stripSecretRefsFromSettings( |
| 875 | settings: unknown, |
| 876 | secretOptionNames: ReadonlySet<string> | null | undefined, |
| 877 | options?: UserScriptSecretSanitizerOptions, |
| 878 | ): void { |
| 879 | if (!isRecord(settings)) return; |
| 880 | |
| 881 | for (const [name, value] of Object.entries(settings)) { |
| 882 | if (isUserScriptSecretRef(value)) { |
| 883 | delete settings[name]; |
| 884 | continue; |
| 885 | } |
| 886 | |
| 887 | if ( |
| 888 | typeof value === "string" && |
| 889 | (secretOptionNames === null || |
| 890 | secretOptionNames?.has(name) || |
| 891 | (secretOptionNames === undefined && |
| 892 | options?.stripUnknownStringSettings === true)) |
| 893 | ) { |
| 894 | delete settings[name]; |
| 895 | } |
| 896 | } |
| 897 | } |
| 898 | |
| 899 | export function stripUserScriptSecretRefsFromCommand( |
| 900 | command: unknown, |
no test coverage detected