How to use the byid.normalizer function in byid

To help you get started, we’ve selected a few byid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github davidecalignano / enginered / src / rss / index.js View on Github external
const feed = new RSS({
    title: 'Enginered',
    description: 'The best tech post from the best tech companies.',
    language: 'en',
    categories: ['Tech', 'Articles', 'Software', 'Engineering'],
    ttl: '60',
    feed_url: 'https://enginered.herokuapp.com/rss',
    site_url: 'https://twitter.com/enginered_',
    generator: 'Enginered',
    webMaster: 'engine.red.blogs@gmail.com',
    language: 'en'
  });

  const articles = await getAllArticles();
  const companies = await getAllCompanies();
  const companiesById = normalizer(companies);

  articles.forEach(article => feed.item({
    title: article.title,
    description: article.description,
    url: article.link,
    categories: article.categories,
    author: companiesById.byId[article.company_id].name,
    date: article.pubdate
  }));

  feed.pubDate = articles[0].pubdate;

  res.set('Content-Type', 'text/xml');
  res.send(feed.xml())
});

byid

Makes array of objects accessible

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis

Popular byid functions