function cacheByIdOrEmail()

in src/GraphService.ts [83:96]


    function cacheByIdOrEmail<T>(profilePromise: Promise<IPersonaProfile>, value: Promise<T>, cacheStorage: { [userId: string]: Promise<T> }) {
        if (!profilePromise) {
            return;
        }

        profilePromise
            .then(profile => {
                cacheStorage[profile.id] = value;
                if (profile.email) {
                    cacheStorage[profile.email] = value;
                }
            })
            .catch(() => { /* don't cache errors */ });
    }