castToString
Cast any input to a string.
Signature
castToString(input: any, default?: string): string
Parameters
Name | Type | Optional | Description |
---|---|---|---|
input | any | No | Specifies the input. |
default | string | Yes | Optional parameter which specifies the default string if the supplied input cannot be casted. |
Return value
Returns the string value.
Example
import { castToString } from "@tripetto/runner";
castToString(1); // Returns `1`
castToString(1.2); // Returns `1.2`
castToString(undefined); // Returns ``