Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const firebase = require('@firebase/app').default;
require('@firebase/database');
var moment = require('moment');
var extend = require('extend');
var url = require('url');
var he = require('he');
firebase.initializeApp({
databaseURL: 'https://hacker-news.firebaseio.com',
});
var hn = firebase.database().ref('/v0');
var hnRecentItems = hn.child('updates/items');
var typeMapping = {
story: 'link'
};
var cleanText = function(html){
if (!html) return;
// yea yea regex to clean HTML is lame yada yada
html = html.replace(/<\/p>/ig, ''); // remove trailing <p></p>s
if (!html.match(/^<p>/i)) html = '</p><p>' + html; // prepend </p><p>
return html;
}
var api = {
</p>