mirror of
https://github.com/mastodon/mastodon.git
synced 2026-10-12 12:58:28 -05:00
9 lines
252 B
TypeScript
9 lines
252 B
TypeScript
/**
|
|
* Returns the input if it is a string, otherwise returns undefined.
|
|
* @param input Any input.
|
|
* @returns The string, or undefined.
|
|
*/
|
|
export function stringOrUndefined(input: unknown) {
|
|
return typeof input === 'string' ? input : undefined;
|
|
}
|