getMessage()function
getMessage(input: unknown): string | undefined
| Param | Type | |
|---|---|---|
input | unknown | The value to read a message from (a string, or an object with a message string). required |
| Return | |
|---|---|
string | undefined | The message string, or undefined if none could be found. |
Return the string message from an unknown value, or return undefined if it could not be found.
Examples
getMessage(new Error("Boom")) // "Boom"getMessage(123) // undefined