Archived
1
0

Implement callback endpoints

VS Code uses these during the authentication flow.
This commit is contained in:
Asher
2020-12-10 15:59:24 -06:00
parent 98338e9a44
commit 58c1be57fa
3 changed files with 120 additions and 3 deletions

View File

@ -101,3 +101,14 @@ export const arrayify = <T>(value?: T | T[]): T[] => {
}
return [value]
}
/**
* Get the first string. If there's no string return undefined.
*/
export const getFirstString = (value: string | string[] | object | undefined): string | undefined => {
if (Array.isArray(value)) {
return value[0]
}
return typeof value !== "object" ? value : undefined
}