<commit_before>import express from 'express';
import StudentStore from '../store/student-store';

let app = express();

app.get('/', (req, res) => {
    let regex = new RegExp("^[a-zA-Z0-9]*$");
    let student = StudentStore.getStudentById(req.query.id);
    if (typeof student === 'undefined') {
        return res.failureJson('The student could not be found.');
    }else if(!regex.test(req.query.id)){
        return res.failureJson('Invalid characters in student ID');
    }
    res.successJson({
        student: {
            id: student.id,
            name: student.name,
            items: student.items.map(item => {
                return {
                    address: item.address,
                    modelAddress: item.modelAddress,
                    status: item.status
                };
            })
        }
    });
});

export default app;
<commit_msg>Small change in where validation is done<commit_after>import express from 'express';
import StudentStore from '../store/student-store';

let app = express();

app.get('/', (req, res) => {
    let regex = new RegExp("^[a-zA-Z0-9]*$");
    let student = StudentStore.getStudentById(req.query.id);

    if(!regex.test(req.query.id)){
        return res.failureJson('Invalid characters in student ID');
    }else if (typeof student === 'undefined') {
        return res.failureJson('The student could not be found.');
    }
    res.successJson({
        student: {
            id: student.id,
            name: student.name,
            items: student.items.map(item => {
                return {
                    address: item.address,
                    modelAddress: item.modelAddress,
                    status: item.status
                };
            })
        }
    });
});

export default app;

{'fraction_non_alphanumeric': 0.1367713004484305, 'fraction_numerical': 0.002242152466367713, 'mean_word_length': 1.8883495145631068, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4366432', 'n_tokens_mistral': 494, 'n_tokens_neox': 480, 'n_words': 122}