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

creamcrop

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

creamcrop - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

docs/sort.md

2

docs/_coverpage.md

@@ -5,3 +5,3 @@ ![header](./assets/Favicon.png)

# Creamcrop <small>v0.8.0</small>
# Creamcrop <small>v0.9.0</small>

@@ -8,0 +8,0 @@ > A cream-of-the-crop, top-of-the-top, slice-and-chop, absolutely minimalist news getter

@@ -5,4 +5,5 @@ * **Documentation**

* [Config](./config.md)
* [Sorting](./sort.md)
* **Other Info**
* [FAQ](./faq.md)

@@ -36,2 +36,3 @@ > Configuration for the package

| `custom` | A custom HTML template. Inside the HTML, use `%feed%`, which will be replaced by the _unread_ content of the feed, and `%read%` for the _read_ content of the feed. Use `%update%` in the HTML, which will be replaced by a script that auto-updates the RSS feed. Use `%search%` in the HTML to get the search bar to filter through results. | A basic HTML page. | The relative path to the HTML template file |
| `read` | Array of URLs which have already been read. Whenever you click a URL on the webpage, it is automatically added here. | `[]` | An array of URLs as strings. |
| `read` | Array of URLs which have already been read. Whenever you click a URL on the webpage, it is automatically added here. | `[]` | An array of URLs as strings. |
| `sort` | File which contains custom sorting script. See [sort](sort.md) for more information | `""` | A string containing the relative file path to the javascript file |

@@ -116,3 +116,3 @@ > Learn the fundamentals of creamcrop

Qlabs (@Quantalabs)
0.8.0
0.9.0
```

@@ -158,3 +158,3 @@

$ cream --version
0.8.0
0.9.0
```
{
"name": "@creamcropdev/creamcrop",
"version": "0.8.0",
"version": "0.9.0",
"description": "A cream-of-the-crop, top-of-the-top, slice-and-chop, absolutely minimalist news getter.",

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

{
"name": "creamcrop",
"version": "0.8.0",
"version": "0.9.0",
"description": "A cream-of-the-crop, top-of-the-top, slice-and-chop, absolutely minimalist news getter.",

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

@@ -102,10 +102,22 @@ const http = require('http');

// Sort all the items in feed.items by date
// Sort all the items in feed.items by date, or by function in config.sort, if it exists
feed.items = feed.items.sort(function(a, b) {
return new Date(b.pubdate) - new Date(a.pubdate);
if (config.sort) {
const sortFunc = require(config.sort);
return sortFunc(a, b);
}
else {
return new Date(b.pubdate) - new Date(a.pubdate);
}
});
// Sort all the items in read.items by date
// Sort all the items in read.items by date, or by function in config.sort, if it exists
read.items = read.items.sort(function(a, b) {
return new Date(b.pubdate) - new Date(a.pubdate);
if (config.sort) {
const sortFunc = require(config.sort);
return sortFunc(a, b);
}
else {
return new Date(b.pubdate) - new Date(a.pubdate);
}
});

@@ -153,2 +165,29 @@

`).join('\n'));
// if %sort% is found, replace it with all the items in feed.items and read.items, sorted by the function in config.sort, or by date, if it doesn't exist
customconf = customconf.replace(/%sort%/g, function() {
if (config.sort) {
const sortFunc = require(config.sort);
// Combine feed.items and read.items
let items = feed.items.concat(read.items);
// Sort the items
items = items.sort(sortFunc);
// Return the items in HTML format
return items.map(item => `
${format(item.title, item.link, item.feedlink, item.feed, item.pubdate, `<div onClick="markRead(${item.link})">`, '</div>')}
`).join('\n');
}
else {
// Combine feed.items and read.items
let items = feed.items.concat(read.items);
// Sort the items
items = items.sort(function(a, b) {
return new Date(b.pubdate) - new Date(a.pubdate);
});
// Return the items in HTML format
return items.map(item => `
${format(item.title, item.link, item.feedlink, item.feed, item.pubdate, `<div onClick="markRead(${item.link})">`, '</div>')}
`).join('\n');
}
});

@@ -155,0 +194,0 @@ // Replace %update% with automatic reloading script with interval in customconf

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