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

cron-parser

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cron-parser - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

.idea/jsLibraryMappings.xml

16

lib/expression.js

@@ -124,2 +124,7 @@ 'use strict';

//Check for valid characters.
if(!CronExpression._validateCharacters(value)){
throw new Error('Invalid characters, got value: ' + value)
}
// Replace '*'

@@ -156,3 +161,3 @@ if (value.indexOf('*') !== -1) {

throw new Error(
'Constraint error, got value ' + value + ' excpected range ' +
'Constraint error, got value ' + value + ' expected range ' +
constraints[0] + '-' + constraints[1]

@@ -174,3 +179,3 @@ );

throw new Error(
'Constraint error, got value ' + result + ' excpected range ' +
'Constraint error, got value ' + result + ' expected range ' +
constraints[0] + '-' + constraints[1]

@@ -247,3 +252,3 @@ );

min + '-' + max +
' excpected range ' +
' expected range ' +
constraints[0] + '-' + constraints[1]

@@ -276,2 +281,7 @@ );

CronExpression._validateCharacters = function(value) {
var regex = new RegExp('^[\\d|/|*|\\-|,]+$');
return regex.test(value);
};
/**

@@ -278,0 +288,0 @@ * Constraint validation

4

lib/parser.js
'use strict';
var fs = require('fs');
var CronExpression = require('./expression');

@@ -128,2 +127,3 @@

CronParser.parseFile = function(filePath, callback) {
var fs = require('fs');
fs.readFile(filePath, function(err, data) {

@@ -139,2 +139,2 @@ if (err) {

module.exports = CronParser;
module.exports = CronParser;
{
"name": "cron-parser",
"version": "0.3.1",
"version": "0.3.2",
"description": "Node.js library for parsing crontab instructions",

@@ -25,3 +25,4 @@ "main": "lib/parser.js",

"Richard Astbury <richard.astbury@gmail.com>",
"Meaglin Wasabi <Meaglin.wasabi@gmail.com>"
"Meaglin Wasabi <Meaglin.wasabi@gmail.com>",
"Mike Kusold <hello@mikekusold.com>"
],

@@ -28,0 +29,0 @@ "license": "MIT",

@@ -150,2 +150,56 @@ var util = require('util');

test('invalid characters test - symbol', function(t) {
CronExpression.parse('10 ! 12 8 0', function(err, interval) {
t.ok(err, 'Error expected');
t.equal(interval, undefined, 'Invalid characters, got value: !');
t.end();
});
});
test('invalid characters test - letter', function(t) {
CronExpression.parse('10 x 12 8 0', function(err, interval) {
t.ok(err, 'Error expected');
t.equal(interval, undefined, 'Invalid characters, got value: x');
t.end();
});
});
test('invalid characters test - parentheses', function(t) {
CronExpression.parse('10 ) 12 8 0', function(err, interval) {
t.ok(err, 'Error expected');
t.equal(interval, undefined, 'Invalid characters, got value: )');
t.end();
});
});
test('interval with invalid characters test', function(t) {
CronExpression.parse('10 */A 12 8 0', function(err, interval) {
t.ok(err, 'Error expected');
t.equal(interval, undefined, 'Invalid characters, got value: */A');
t.end();
});
});
test('range with invalid characters test', function(t) {
CronExpression.parse('10 0-z 12 8 0', function(err, interval) {
t.ok(err, 'Error expected');
t.equal(interval, undefined, 'Invalid characters, got value: 0-z');
t.end();
});
});
test('group with invalid characters test', function(t) {
CronExpression.parse('10 0,1,z 12 8 0', function(err, interval) {
t.ok(err, 'Error expected');
t.equal(interval, undefined, 'Invalid characters, got value: 0,1,z');
t.end();
});
});
test('range test with iterator', function(t) {

@@ -152,0 +206,0 @@ CronExpression.parse('10-30 2 12 8 0', function(err, interval) {

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