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

node-red-contrib-trashschedule

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-trashschedule - npm Package Compare versions

Comparing version 1.0.4 to 1.1.5

.github/workflows/npm-publish.yml

0

.github/ISSUE_TEMPLATE/bug_report.md

@@ -0,0 +0,0 @@ ---

7

package.json
{
"name": "node-red-contrib-trashschedule",
"version": "1.0.4",
"version": "1.1.5",
"deprecated": false,

@@ -12,3 +12,3 @@ "description": "NodeRED Node to manage trash schedule events",

"scripts": {
"test": ""
"test": "jest"
},

@@ -30,3 +30,4 @@ "keywords": [

"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1"
"eslint-plugin-import": "^2.22.1",
"jest": "^26.6.3"
},

@@ -33,0 +34,0 @@ "repository": {

@@ -0,0 +0,0 @@ ![banner](img/trashschedule_banner.svg)

/* eslint-disable no-shadow */
/* eslint-disable prefer-destructuring */
// eslint-disable-next-line func-names
const validateEvent = require('./src/validateEvent');
const sortTrashschedule = require('./src/sortTrashschedule');
// eslint-disable-next-line func-names
module.exports = function (RED) {

@@ -9,5 +14,3 @@ function trashschedule(config) {

let trashschedule = [];
trashschedule = config.trashschedule;
let trashschedule = config.trashschedule;
const skipHour = config.skipHour;

@@ -31,33 +34,2 @@

// sort trashschedule array by yyyy, mm, dd
function sortTrashschedule() {
trashschedule.sort((a, b) => {
if (new Date(a.year, a.month, a.day) > new Date(b.year, b.month, b.day)) {
return 1;
}
if (new Date(a.year, a.month, a.day) < new Date(b.year, b.month, b.day)) {
return -1;
}
return 0;
});
}
function validateEvent(trashscheduleElement) {
if (trashscheduleElement == null) {
return false;
}
if (new Date(
trashscheduleElement.year,
trashscheduleElement.month,
trashscheduleElement.day,
).valueOf() - new Date(
currentYear,
currentMonth,
currentDay,
).valueOf() < 0) {
return false;
}
return true;
}
// calculate daysLeft

@@ -79,3 +51,4 @@ function calcDaysLeft(trashscheduleElement) {

function sendNextThreeTrashEvents() {
sortTrashschedule();
// sort trashschedule array by yyyy, mm, dd
trashschedule = sortTrashschedule(trashschedule);

@@ -215,3 +188,4 @@ // outputArr bundles the 3 events

function checkTrashschedule() {
sortTrashschedule();
// sort trashschedule array by yyyy, mm, dd
trashschedule = sortTrashschedule(trashschedule);

@@ -294,2 +268,6 @@ // check wether trashschedule array contains trashschedule events

break;
case '123':
trashschedule = sortTrashschedule(trashschedule);
node.send({ payload: trashschedule });
break;
default:

@@ -296,0 +274,0 @@ checkTrashschedule();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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