<commit_before>var _ = require('lodash');
var dao = require('./dao');
var facebookService = require('./facebook');
var userService = {};
var usersPromise = _.memoize(dao.getUsers);

userService.saveUsers = function(users) {
    dao.saveUsers(users);
};

userService.getUser = function(userId) {
    return usersPromise().then(function(users) {
        return _.sortBy(users[userId]);
    });
};

userService.getList = function(accessToken) {
    return usersPromise()
        .then(function(users) {
            var userIds = Object.keys(users);
            return facebookService.getUsers(accessToken, userIds)
                .then(function(facebookUsers) {
                    return _(facebookUsers)
                        .map(function(user) {
                            user.count = users[user.id].length;
                            return user;
                        })<commit_msg>Update user.js<commit_after>var _ = require('lodash');
var dao = require('./dao');
var facebookService = require('./facebook');
var userService = {};
var usersPromise = _.memoize(dao.getUsers);

userService.saveUsers = function(users) {
    dao.saveUsers(users);
};

userService.getUser = function(userId) {
    return usersPromise.then(function(users) {
        return _.sortBy(users[userId]);
    });
};

userService.getList = function(accessToken) {
    return usersPromise
        .then(function(users) {
            var userIds = Object.keys(users);
            return facebookService.getUsers(accessToken, userIds)
                .then(function(facebookUsers) {
                    return _(facebookUsers)
                        .map(function(user) {
                            user.count = users[user.id].length;
                            return user;
                        })
{'fraction_non_alphanumeric': 0.12394840157038699, 'fraction_numerical': 0.0, 'mean_word_length': 2.146384479717813, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6584217', 'n_tokens_mistral': 479, 'n_tokens_neox': 472, 'n_words': 83}