@6degrees/node-cron-utils
Advanced tools
Comparing version 0.0.2 to 0.0.3
16
main.js
@@ -32,3 +32,9 @@ class utils { | ||
} | ||
new_expression["seconds"] = `${step}/${doubledRange}`; | ||
if(add_to_minutes){ | ||
new_expression["seconds"] = `${doubledRange}`; | ||
} | ||
else{ | ||
new_expression["seconds"] = `${step}/${doubledRange}`; | ||
} | ||
} | ||
@@ -40,3 +46,9 @@ else if(expression["seconds"] == "*"){ // * | ||
else{ // 5 | ||
let range = expression["seconds"]; | ||
let doubledRange = parseInt(range) * 2; | ||
if(doubledRange >= 60){ | ||
add_to_minutes = Math.floor(doubledRange / 60); | ||
doubledRange = doubledRange % 60; | ||
} | ||
new_expression["seconds"] = `${doubledRange}`; | ||
} | ||
@@ -43,0 +55,0 @@ |
{ | ||
"name": "@6degrees/node-cron-utils", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Utilities functions to manipulate node-cron expressions", | ||
@@ -19,2 +19,6 @@ "main": "main.js", | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"private": false, | ||
"author": "Mohannad F. Otaibi", | ||
@@ -21,0 +25,0 @@ "license": "ISC", |
@@ -25,16 +25,16 @@ | ||
test('testing */40 * * * * *', ()=>{ | ||
expect(hi.double("*/40 * * * * *")).toBe("*/20 */1 * * * *") | ||
expect(hi.double("*/40 * * * * *")).toBe("20 */1 * * * *") | ||
}) | ||
test('testing */20 */1 * * * *', ()=>{ | ||
expect(hi.double("*/20 */1 * * * *")).toBe("*/40 */2 * * * *") | ||
test('testing 20 */1 * * * *', ()=>{ | ||
expect(hi.double("20 */1 * * * *")).toBe("40 */2 * * * *") | ||
}) | ||
test('testing */40 */1 * * * *', ()=>{ | ||
expect(hi.double("*/40 */1 * * * *")).toBe("*/20 */3 * * * *") | ||
test('testing 40 */1 * * * *', ()=>{ | ||
expect(hi.double("40 */1 * * * *")).toBe("20 */3 * * * *") | ||
}) | ||
test('testing */40 */40 * * * *', ()=>{ | ||
expect(hi.double("*/40 */40 * * * *")).toBe("*/20 */21 * * * *") // Not sure if this is correct | ||
test('testing 40 */40 * * * *', ()=>{ | ||
expect(hi.double("40 */40 * * * *")).toBe("20 */21 * * * *") // Not sure if this is correct | ||
}) | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
98
6957
7