Created
March 6, 2019 13:32
-
-
Save pizzacat83/e6c5c6b753b6ec817237c2ced34db303 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getPersonName = (resourceName: string): string => { | |
let name: string = cache.get(`getPersonName.${resourceName}`); | |
if (name) return name; | |
const person: PeopleAPI.Person = People.People.get(resourceName, { personFields: 'names' }); | |
if (person.names) { | |
name = person.names[0].displayName; | |
cache.put(`getPersonName.${resourceName}`, name, 21600); | |
return name; | |
} | |
return resourceName; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment