<commit_before>/// <reference path="../../../../typings/bundle.d.ts" />

import fs = require('fs');
import APIResponse = require('../../api-response');
import Streamer = require('../../../utils/streaming');
import AccessToken = require('../../../models/access-token');
import Application = require('../../../models/application');
import User = require('../../../models/user');

var authorize = require('../../auth');

var usersShow = (req: any, res: APIResponse) => {
	authorize(req, res,(user: User, app: Application) => {
		if (req.body.user_id != null) {
			var userId = req.body.user_id;
			User.find(userId,(targetUser: User) => {
				if (targetUser != null) {
					res.apiRender(targetUser.filt());
				} else {
					res.apiError(404, 'User not found...');
				}
			});
		} else {
			res.apiError(400, 'user_id parameter is required :(');
		}<commit_msg>Refactoring<commit_after>/// <reference path="../../../../typings/bundle.d.ts" />

import fs = require('fs');
import APIResponse = require('../../api-response');
import Streamer = require('../../../utils/streaming');
import Application = require('../../../models/application');
import User = require('../../../models/user');

var authorize = require('../../auth');

var usersShow = (req: any, res: APIResponse) => {
	authorize(req, res,(user: User, app: Application) => {
		if (req.body.user_id == null) {
			res.apiError(400, 'user_id parameter is required :(');
			return;
		}
		var userId = req.body.user_id;

		User.find(userId,(targetUser: User) => {
			if (targetUser != null) {
				res.apiRender(targetUser.filt());
			} else {
				res.apiError(404, 'User not found...');
			}
		});
{'fraction_non_alphanumeric': 0.23529411764705882, 'fraction_numerical': 0.0072771376591873865, 'mean_word_length': 3.064039408866995, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '6784726', 'n_tokens_mistral': 575, 'n_tokens_neox': 515, 'n_words': 113}