Last active
October 5, 2024 00:19
-
-
Save munierujp/1314aee36a29268c4cd437d895278119 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class SensitiveParameter<T> { | |
private readonly value: T | |
private readonly masked: string | |
constructor (value: T, masked: string = '***') { | |
this.value = value | |
this.masked = masked | |
} | |
/** | |
* This method always returns masked value. | |
* @returns masked value | |
*/ | |
toString (): string { | |
return this.masked | |
} | |
get rawValue (): T { | |
return this.value | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment