Get word meaning from Urban Dictionary

Function JavaScript 1 revisions 218 a year ago a year ago
const axios = require('axios');

function wat(term) {
	return axios.get('https://api.urbandictionary.com/v0/define', {params: {term}})
		.then(response => ({
			definition: response.data.list[0].definition,
			example: response.data.list[0].example,
			votes: response.data.list[0].thumbs_up - response.data.list[0].thumbs_down,

This gets the definition of a thing from Urban Dictionary thing.


{ definition: 'Acronym for "be right back"',
  example: 'Hey, brb, g2g take a shit',
  votes: 3228 }

You can use something other than axios but Promises ftw.