<commit_before>var models = require("../../models")
module.exports = function(screenName,id){
    if(!screenName && !id) return Promise.reject("screenName-or-id-require")
    var promise;
    if(screenName) {
        promise = models.users.findOne({screenNameLower:screenName.toLowerCase()}).populate("avatar")
    } else {
        promise = models.users.findOne({_id:models.mongoose.Types.ObjectId(id)}).populate("avatar")
    }
    return promise.then(function(user){
        if(!user) return Promise.reject("user-not-found")
        if(user.isSuspended) return Promise.reject("this-user-is-suspended")
        return models.follows.find({
            fromUser:user.id
        }).populate("toUser")
    }).then(function(follows){
        var following_users = [];
        follows.forEach(function(follow){
            if(!follow.toUser.isSuspended) following_users.push(follow.toUser);
        })
        return Promise.resolve(following_users)
    })
}
<commit_msg>following一覧を実装<commit_after>var models = require("../../models")
module.exports = function* (screenName,id){
    if(!screenName && !id) return Promise.reject("screenName-or-id-require")
    var user;
    if(screenName) {
        user = yield models.users.findOne({screenNameLower:screenName.toLowerCase()}).populate("avatar")
    } else {
        user = yield models.users.findOne({_id:models.mongoose.Types.ObjectId(id)}).populate("avatar")
    }
    if(!user) return Promise.reject("user-not-found")
    if(user.isSuspended) return Promise.reject("this-user-is-suspended")
    var follows = yield models.follows.find({
        fromUser:user.id
    }).populate("toUser")
    follows = follows.map(follow => follow.toUser).filter(user => !user.isSuspended)
    return follows;
}

{'fraction_non_alphanumeric': 0.15741270749856898, 'fraction_numerical': 0.0, 'mean_word_length': 3.528497409326425, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5428265', 'n_tokens_mistral': 537, 'n_tokens_neox': 542, 'n_words': 75}