{"size": 629, "ext": "js", "max_stars_repo_path": "spongebob-mock.js", "max_stars_repo_name": "hjdarnel/lambdas", "max_stars_repo_stars_event_min_datetime": "2019-05-17T22:11:19.000Z", "max_stars_repo_stars_event_max_datetime": "2019-05-17T22:11:19.000Z", "max_issues_repo_path": "spongebob-mock.js", "max_issues_repo_name": "hjdarnel/lambdas", "max_issues_repo_issues_event_min_datetime": "2019-02-07T20:38:12.000Z", "max_issues_repo_issues_event_max_datetime": "2021-03-11T18:11:16.000Z", "max_forks_repo_path": "spongebob-mock.js", "max_forks_repo_name": "hjdarnel/lambdas", "max_forks_repo_forks_event_min_datetime": "2019-09-11T16:38:34.000Z", "max_forks_repo_forks_event_max_datetime": "2019-09-11T16:38:34.000Z"}
{"max_stars_count": 1, "max_issues_count": 6, "max_forks_count": 1, "avg_line_length": 27.347826087, "max_line_length": 76, "alphanum_fraction": 0.5914149444}
const parse = require('urlencoded-body-parser');
const axios = require('axios');

const alternateCase = function (s) {
    let chars = s.toLowerCase().split("");
    for (let i = 0; i < chars.length; i += 2) {
        chars[i] = chars[i].toUpperCase();
    }
    return chars.join("");
};

module.exports = async (req, res) => {
    const { text, response_url } = await parse(req);

    await axios.post(response_url, {
            response_type: "in_channel",
            text: `:spongebob-mock: ${alternateCase(text)} :spongebob-mock:`
    });

    res.writeHead(200, { 'Content-Type': 'application/json' });
    res.end();
};
