Last active
December 25, 2020 20:02
-
-
Save sudomann/77e0316a6ec74db9c8d999407c980e8b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* ETL function to gather all person type contacts from device | |
* @returns {Promise<{ name: string, nickname: string, maidenName: string, phoneNumbers: string[], emails: string[] }[]>} An promise resolved to an array of 0 or more transformed contacts | |
*/ | |
export const extractAndTransformContacts = async () => | |
Contacts.getContactsAsync({ | |
fields: QUERY_FIELDS, | |
pageSize: 0, | |
}).then(({ data }) => { | |
const transformedContacts = produceContacts(data); | |
console.log('all contacts:', transformedContacts); | |
return transformedContacts; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment