<commit_before>
/**
 * @description  a string as a parameter, passed through the url, is checked to see whether that string contains either a
 * unix timestamp or a natural language date (example: January 1, 2016).
 * @returns the Unix timestamp and the natural language form of the date or null
 **/
 
var express = require('express')
  ,strftime = require('strftime')
  ,app = express();

app.get("/", (req,res) => {
  
  res.send( "<h1>API Basejump: Timestamp microservice</h1><p>For more information visit this <a href='https://timestamp-ms.herokuapp.com/'>link</a></P>");
  
});

app.get('/:query', (req, res) => {
  
  var query = req.params.query
  var output = {}
  var time;
  if (isNaN(Number(query))) { //if not timestamp
    if (new Date(query) !== 'Invalid Date') { //if valid date
      time = new Date(query)
    } else {
      time = null
    }
  } else { //if timestamp
    console.log(Number(query))
    time = new Date(Number(query) * 1000)
  }

  if (time === null) {
    output = { 'unix': null, 'natural': null }
  } else {
    output = { 'unix': time.getTime() / 1000, 'natural': strftime('%B %d, %Y', time) }
  }
  console.log(output)
  res.send(JSON.stringify(output))
    
  });
 
app.listen(process.env.PORT || 8080, function () {
  console.log('Example app listening on port 8080!');
});<commit_msg>Replace if else statement for ouput with a turnary statement<commit_after>
/**
 * @description  a string as a parameter, passed through the url, is checked to see whether that string contains either a
 * unix timestamp or a natural language date (example: January 1, 2016).
 * @returns the Unix timestamp and the natural language form of the date or null
 **/
 
var express = require('express')
  ,strftime = require('strftime')
  ,app = express();

app.get("/", (req,res) => {
  
  res.send( "<h1>API Basejump: Timestamp microservice</h1><p>For more information visit this <a href='https://timestamp-ms.herokuapp.com/'>link</a></P>");
  
});

app.get('/:query', (req, res) => {
  
  var query = req.params.query
    ,output = {}
    ,time;
  
  if (isNaN(Number(query))) { //if not timestamp
    if (new Date(query) !== 'Invalid Date') { //if valid date
      time = new Date(query);
    } else {
      time = null;
    }
  } else { //if timestamp
    time = new Date(Number(query) * 1000);
  }

  time === null ? output = { 'unix': null, 'natural': null } : output = { 'unix': time.getTime() / 1000, 'natural': strftime('%B %d, %Y', time) } ;

  console.log(output);
  res.send(JSON.stringify(output));
    
});
 
app.listen(process.env.PORT || 8080, function () {
  console.log('Example app listening on port 8080!');
});
{'fraction_non_alphanumeric': 0.16710675216899284, 'fraction_numerical': 0.01735194266314598, 'mean_word_length': 3.32626427406199, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, 'https://': 2, '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': '4167261', 'n_tokens_mistral': 910, 'n_tokens_neox': 855, 'n_words': 268}