Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

just-nu

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

just-nu - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

test.js

71

just-nu.js
#! /usr/bin/env node
/* eslint-env node */
/* eslint no-console:0 */
'use strict';
const http = require('http');
const colour = require('colour');
let justNuCount = 0
, justNuTopics = [];
console.log(colour.yellow(' --------------------- '));
console.log(colour.yellow(' A F T O N B L A D E T '));
console.log(colour.yellow(' --------------------- '));
console.log('\n');
/**

@@ -35,3 +25,3 @@ * Find number of "JUST NU:" in a string.

const parts = text.split('<span');
let subtitles = [];
const subtitles = [];

@@ -106,41 +96,26 @@ function containsArrow (str) {

/**
* Prints to console.
*
* @param {Number} count - Number of "JUST NU :"s to reportAndClose
* @param {String[]} topics - Array of topics as strings to list in console.
*/
function reportAndClose (count, topics) {
console.log(colour.white(` Antal ${'JUST NU'.bold} just nu:`), colour.cyan(count));
module.exports = function (callback) {
let justNuCount = 0
, justNuTopics = []
;
console.log('\n');
http.request({ host: 'www.aftonbladet.se' }, res => {
res.setEncoding('utf8');
for (let topic of topics) {
let header = 'JUST NU:'.red.bold;
res.on('data', chunk => {
let count = getJustNuCount(chunk);
console.log(` ${header} ${topic.header}`);
if (count > 0) {
justNuCount += count;
justNuTopics = justNuTopics.concat(getTopics(chunk));
}
});
for (let subtitle of topic.subtitles) {
let symbol = colour.red(subtitle.symbol);
console.log(` ${symbol} ${subtitle.subtitle}`);
}
}
process.exit(0);
}
http.request({ host: 'www.aftonbladet.se' }, res => {
res.setEncoding('utf8');
res.on('data', chunk => {
let count = getJustNuCount(chunk);
if (count > 0) {
justNuCount += count;
justNuTopics = justNuTopics.concat(getTopics(chunk));
}
});
res.on('end', () => reportAndClose(justNuCount, justNuTopics));
}).end();
res.on('end', () => {
const count = justNuCount;
const topics = justNuTopics;
callback({ count, topics });
});
}).end();
};
{
"name": "just-nu",
"version": "2.2.0",
"version": "2.2.1",
"description": "Antal JUST NU på Aftonbladet",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc