Class: Secret<T>
Define a Secret value that hides itself from the logs or the console statements.
The idea is to prevent accidental leaking of sensitive information. Idea borrowed from. https://transcend.io/blog/keep-sensitive-values-out-of-your-logs-with-types
Type Parameters
| Type Parameter |
|---|
T |
Constructors
Constructor
ts
new Secret<T>(value: T, redactedKeyword?: string): Secret<T>;Parameters
| Parameter | Type |
|---|---|
value | T |
redactedKeyword? | string |
Returns
Secret<T>
Methods
map()
ts
map<R>(transformFunc: (value: T) => R): Secret<R>;Transform the original value and create a new secret from it.
Type Parameters
| Type Parameter |
|---|
R |
Parameters
| Parameter | Type |
|---|---|
transformFunc | (value: T) => R |
Returns
Secret<R>
release()
ts
release(): T;Returns the original value
Returns
T
toJSON()
ts
toJSON(): string;Returns
string
toLocaleString()
ts
toLocaleString(): string;Returns
string
toString()
ts
toString(): string;Returns
string
valueOf()
ts
valueOf(): string;Returns
string