<commit_before>import express from 'express';

import Script from '../models/script';

let router = new express.Router();

router.get('/', (req, res) => {
    Script.find({}, (err, scripts) => {
        res.send({ success: true, data: scripts });
    });
});

router.get('/:scriptId', (req, res) => {
    const scriptId = req.params.scriptId;
    
    Script.findOne({ _id: scriptId }, (err, script) => {
        res.send({ success: true, data: script });
    });
});

router.post('/', (req, res) => {
    let rawScriptData = req.body;
    let newScript = new Script();

    newScript.name = rawScriptData.name;
    newScript.executableData = rawScriptData.executableData;
    newScript.type = rawScriptData.type;

    newScript.save((err, user) => {
        if (err) {
            res.send({ success: false, data: err });
        }
        res.send({ success: true, data: user });
    });

});

router.put('/:scriptId', (req, res) => {
    const scriptId = req.params.scriptId;
    let rawScriptData = req.body;

    Script.update({ _id: scriptId }, {
            name: rawScriptData.name,
            executableData: rawScriptData.executableData,
            type: rawScriptData.type
        },
        function(err, raw) {
            if (err) {
                res.send({ success: false, data: err });
            }
            else {
                res.send({ success: true, data: raw });
            }
        }
    );
});

export default router;<commit_msg>Fixed a typo<commit_after>import express from 'express';

import Script from '../models/script';

let router = new express.Router();

router.get('/', (req, res) => {
    Script.find({}, (err, scripts) => {
        res.send({ success: true, data: scripts });
    });
});

router.get('/:scriptId', (req, res) => {
    const scriptId = req.params.scriptId;
    
    Script.findOne({ _id: scriptId }, (err, script) => {
        res.send({ success: true, data: script });
    });
});

router.post('/', (req, res) => {
    let rawScriptData = req.body;
    let newScript = new Script();

    newScript.name = rawScriptData.name;
    newScript.executableData = rawScriptData.executableData;
    newScript.type = rawScriptData.type;

    newScript.save((err, script) => {
        if (err) {
            res.send({ success: false, data: err });
        }
        res.send({ success: true, data: script });
    });

});

router.put('/:scriptId', (req, res) => {
    const scriptId = req.params.scriptId;
    let rawScriptData = req.body;

    Script.update({ _id: scriptId }, {
            name: rawScriptData.name,
            executableData: rawScriptData.executableData,
            type: rawScriptData.type
        },
        function(err, raw) {
            if (err) {
                res.send({ success: false, data: err });
            }
            else {
                res.send({ success: true, data: raw });
            }
        }
    );
});

export default router;
{'fraction_non_alphanumeric': 0.1629730651210365, 'fraction_numerical': 0.0, 'mean_word_length': 2.158234660925727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '105161', 'n_tokens_mistral': 902, 'n_tokens_neox': 890, 'n_words': 211}