<commit_before>module.exports = function ({
    subscriptions,
    createMember,
    updateMember,
    getMember,
    listMembers,
    deleteMember,
    validateMember,
    sendEmail,
    encodeToken,
    decodeToken
}) {
    function requestPasswordReset({email}) {
        return getMember({email}).then((member) => {
            return encodeToken({
                sub: member.id
            }).then((token) => {
                return sendEmail(member, {token});
            });
        }, (/*err*/) => {
            // Ignore user not found err;
        });
    }

    function resetPassword({token, password}) {
        return decodeToken(token).then(({sub}) => {
            return updateMember({id: sub}, {password});
        });
    }

    function get(...args) {
        return getMember(...args).then((member) => {
            return subscriptions.getAdapters().then((adapters) => {
                return Promise.all(adapters.map((adapter) => {
                    return subscriptions.getSubscription(member, {
                        adapter
                    }).then((subscription) => {
                        return Object.assign(subscription, {adapter});
                    });
                }));
            }).then((subscriptions) => {
                return Object.assign({}, member, {
                    subscriptions: subscriptions.filter(sub => sub.status === 'active')
                });
            });
        });
    }

    function destroy(...args) {
        return getMember(...args).then((member) => {
            if (!member) {
                return null;
            }
            return subscriptions.getAdapters().then((adapters) => {
                return Promise.all(adapters.map((adapter) => {
                    return subscriptions.removeCustomer(member, {
                        adapter
                    });
                }));
            }).then(() => {
                return deleteMember(...args);<commit_msg>Updated getMember to return plans<commit_after>module.exports = function ({
    subscriptions,
    createMember,
    updateMember,
    getMember,
    listMembers,
    deleteMember,
    validateMember,
    sendEmail,
    encodeToken,
    decodeToken
}) {
    function requestPasswordReset({email}) {
        return getMember({email}).then((member) => {
            return encodeToken({
                sub: member.id
            }).then((token) => {
                return sendEmail(member, {token});
            });
        }, (/*err*/) => {
            // Ignore user not found err;
        });
    }

    function resetPassword({token, password}) {
        return decodeToken(token).then(({sub}) => {
            return updateMember({id: sub}, {password});
        });
    }

    function get(...args) {
        return getMember(...args).then((member) => {
            return subscriptions.getAdapters().then((adapters) => {
                return Promise.all(adapters.map((adapter) => {
                    return subscriptions.getSubscription(member, {
                        adapter
                    }).then((subscription) => {
                        return Object.assign(subscription, {adapter});
                    });
                }));
            }).then((subscriptions) => {
                const activeSubscriptions = subscriptions.filter(sub => sub.status === 'active');
                return Object.assign({}, member, {
                    subscriptions: activeSubscriptions,
                    plans: activeSubscriptions.map(sub => sub.plan)
                });
            });
        });
    }

    function destroy(...args) {
        return getMember(...args).then((member) => {
            if (!member) {
                return null;
            }
            return subscriptions.getAdapters().then((adapters) => {
                return Promise.all(adapters.map((adapter) => {
                    return subscriptions.removeCustomer(member, {
                        adapter
                    });
                }));
            }).then(() => {
                return deleteMember(...args);
{'fraction_non_alphanumeric': 0.13727405959941377, 'fraction_numerical': 0.0, 'mean_word_length': 1.4535650089874177, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4196606', 'n_tokens_mistral': 1005, 'n_tokens_neox': 957, 'n_words': 169}