Socket
Socket
Sign inDemoInstall

dynamic-timer

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamic-timer - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

test/events.js

11

lib/timer.js

@@ -113,14 +113,15 @@ var util = require('util'),

// bind seed and first delay.
!isNaN(options.seed) && (options.seed = 1000);
!isNaN(options.delay) && (options.delay = 1000);
isNaN(options.seed) && (options.seed = 1000);
isNaN(options.delay) && (options.delay = 1000);
// strategy must be one value of `Timer.strategy`.
options.strategy = options.strategy.toLowerCase();
if(!~Object.keys(Timer.strategy).indexOf(options.strategy)){
if(!~Object.keys(Timer.strategy).indexOf(options.strategy.toUpperCase())){
options.strategy = Timer.strategy.DAYAN;
}
// overrun must be one value of [Timer.state.STOP, Timer.state.RESET, Timer.state.OVERLOAD].
options.overrun = options.overrun.toLowerCase();
if(!~[Timer.state.STOP, Timer.state.RESET, Timer.state.OVERLOAD].indexOf(options.overrun)){
options.overrun = Timer.strategy.OVERLOAD;
options.overrun = Timer.state.OVERLOAD;
}

@@ -261,3 +262,3 @@

'FIBONACCI': 'fibonacci',
'PROCESSION': 'arithmetic procession',
'PROCESSION': 'procession',
'LUCAS': 'lucas',

@@ -264,0 +265,0 @@ 'DAYAN': 'da yan'

{
"name": "dynamic-timer",
"version": "1.0.2",
"description": "Schedule execution of a one-time callback after delay milliseconds, automatic, intelligence and without bothering, the delay is calculated from different algorithms, e.g.: Lucas Sequence, Fibonacci Sequence, DaYan Series and Arithmetic Procession.",
"version": "1.0.3",
"description": "Schedule execution of a multi-time callback after delay milliseconds, automatic, intelligence and without bothering, the delay is calculated from different algorithms, e.g.: Lucas Sequence, Fibonacci Sequence, DaYan Series and Arithmetic Procession.",
"main": "lib/timer.js",
"scripts": {
"test": "mocha -R Spec -t 10000"
"test": "mocha -R Spec -t 300000"
},

@@ -9,0 +9,0 @@ "repository": {

dynamic-timer [![NPM version](https://badge.fury.io/js/dynamic-timer.svg)](http://badge.fury.io/js/dynamic-timer) [![Build Status](https://travis-ci.org/Tjatse/dynamic-timer.svg?branch=master)](https://travis-ci.org/Tjatse/dynamic-timer)
=============
Schedule execution of a one-time callback after delay milliseconds, automatic, intelligence and without bothering, the delay is calculated from different algorithms, e.g.: Lucas Sequence, Fibonacci Sequence, DaYan Series and Arithmetic Procession.
Schedule execution of a multi-time callback after delay milliseconds, automatic, intelligence and without bothering, the delay is calculated from different algorithms, e.g.: Lucas Sequence, Fibonacci Sequence, DaYan Series and Arithmetic Procession.

@@ -45,3 +45,3 @@ **So, the next `delay` will be generated by the specific strategy, but not a fixed one. This will take a high performance on long-polling, handshake, ping-pong, reconnect, task worker or something else.**

Timer supports four strategies:
- **arithmetic procession**
- **procession**
Arithmetic Procession, equals `dynamicTimeout.strategy.PROCESSION`, the sequence increases like:

@@ -191,4 +191,4 @@ ```

## TODO
[ ] Test cases.
[ ] Typo bug fixing.
- [ ] Test cases.
- [ ] Typo bug fixing.

@@ -195,0 +195,0 @@ ## License

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