<commit_before>import {User} from './models';
import {IUser} from './interfaces';
import config from './config';

export default function(req: any): Promise<any> {
	'use strict';
	return new Promise<Object>((resolve, reject) => {
		if (req.headers['passkey'] !== undefined && req.headers['passkey'] !== null) {
			if (req.headers['passkey'] === config.apiPasskey) {
				if (req.headers['user-id'] !== null) {
					User.findById(req.headers['user-id'], (err: any, user: IUser) => {
						resolve({
							app: null,
							user: user
						});
					});
				} else {
					resolve({
						app: null,
						user: null
					});
				}
			} else {
				reject();
			}
		} else {
			resolve({
				app: null,
				user: null
			});
		}
	});
}<commit_msg>Improve readability<commit_after>import {User} from './models';
import {IUser} from './interfaces';
import config from './config';

export default function(req: any): Promise<any> {
	'use strict';
	return new Promise<Object>((resolve, reject) => {
		if (req.headers['passkey'] === undefined || req.headers['passkey'] === null) {
			resolve({ app: null, user: null });
		} else if (req.headers['passkey'] !== config.apiPasskey) {
			reject();
		} else if (req.headers['user-id'] === null) {
			resolve({ app: null, user: null });
		} else {
			User.findById(req.headers['user-id'], (err: any, user: IUser) => {
				resolve({
					app: null,
					user: user
				});
			});
		}
	});
}
{'fraction_non_alphanumeric': 0.20224719101123595, 'fraction_numerical': 0.0, 'mean_word_length': 3.0482954545454546, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2175645', 'n_tokens_mistral': 583, 'n_tokens_neox': 472, 'n_words': 117}