Enhanced interval features for Node.js, such as promisified interval and human readable time parsing.

Overview

Interval-next

Interval-next is a package that extends Javascript's built-in setInterval() capabilities. You have a plain and promisified interval method, which you can also use as a sleep code. It allows you to use human parseable time, such as 15 second or 20 minute, and also more complex times such as 1 day, 12 hour and 30 second, which you can take a look at more detailed examples down below. Functions returns the interval object itself, which you can use later to kill the interval with built-in clearInterval() method.

Example usage

IntervalNext .set(<callbackFn>, <human readable time>,<immediate: boolean>?)

const  IntervalNext  =  require("interval-next")

const  Interval  =  IntervalNext.set(()  =>  {

// do something

}), "1 day, 12 hour and 30 minute")

IntervalNext.setAsync(<callbackFn>, <human readable time>,<immediate: boolean>?)

const  IntervalNext  =  require("interval-next")

const  Interval  =  IntervalNext.setAsync(()  =>  {

// do something

}), "20 minute and 30 second", true)

Complex time parsing

Interval-next can understand and parse all of the following examples.

const  Interval  =  IntervalNext.set(()  =>  {}), "20 minute and 30 second")
const  Interval  =  IntervalNext.set(()  =>  {}), "1 hour, 45 minute and 30 second")
const  Interval  =  IntervalNext.set(()  =>  {}), "1 month, 15 day, 12 hour and 30 minute")
const  Interval  =  IntervalNext.set(()  =>  {}), "1 year, 6 month, 15 day hour, 12 hour and 15 second")

Accepted units

  • second

  • minute

  • hour

  • day

  • month (assumed 30 days)

  • year (assumed 365 days)

Plans

  • Adding an override support for human readable time, allowing to use numbers

  • Revamping readable time to make it more useful, by adding complex time parsing

  • Adding stopping and resuming to intervals

  • Adding killInterval() function, to enhance the capabilities of default clearInterval() method

You might also like...

An enhanced HTML 5 file input for Bootstrap 5.x/4.x./3.x with file preview, multiple selection, and more features.

An enhanced HTML 5 file input for Bootstrap 5.x/4.x./3.x with file preview, multiple selection, and more features.

bootstrap-fileinput An enhanced HTML 5 file input for Bootstrap 5.x, 4.x, and 3.x with file preview for various files, offers multiple selection, resu

Jan 3, 2023

A Tailwind plugin that allows to create multiple groups utilities such as group-card or group-1 and works with Tailwind 3 features and all variations.

Tailwind Labeled Groups A plugin that allows to create multiple groups utilities such as group-card or group-1 and works with Tailwind 3 features and

Nov 21, 2022

A fast and powerful http toolkit that take a list of domains to find active domains and other information such as status-code, title, response-time , server, content-type and many other

A fast and powerful http toolkit that take a list of domains to find active domains and other information such as status-code, title, response-time , server, content-type and many other

HTTPFY curently in beta so you may see problems. Please open a Issue on GitHub and report them! A Incredible fast and Powerful HTTP toolkit Report Bug

Dec 22, 2022

Apollo - a JavaScript library to get real-time economic declarations such as inflation rates

Apollo is a JavaScript library to get real-time economic declarations such as inflation rates, unemployment rates or interest rates reported by governments or other entities.

Dec 10, 2022

A TOML parsing tool written in Rust for Node.js

@daydog/toml A TOML parsing tool written in Rust for Node.js Installation @daydog/toml is available via npm. npm install @daydog/toml Usage parse You

Jul 20, 2022

Workshop: Crafting Human Friendly CLIs with Node.js Core

$ Crafting Human Friendly CLIs with Node.js Core █ A workshop by Simon Plenderleith & Kevin Cunningham. Getting ready for the workshop 1. Required sof

Dec 26, 2022

Framework agnostic CLI tool for routes parsing and generation of a type-safe helper for safe route usage. 🗺️ Remix driver included. 🤟

Framework agnostic CLI tool for routes parsing and generation of a type-safe helper for safe route usage. 🗺️ Remix driver included. 🤟

About routes-gen is a framework agnostic CLI tool for routes parsing and generation of a type-safe helper for safe route usage. Think of it as Prisma,

Jan 2, 2023

This is a Google Apps Script library for parsing the form object from HTML form and appending the submitted values to the Spreadsheet.

This is a Google Apps Script library for parsing the form object from HTML form and appending the submitted values to the Spreadsheet.

HtmlFormApp Overview This is a Google Apps Script library for parsing the form object from HTML form and appending the submitted values to the Spreads

Oct 23, 2022

Runtime object parsing and validation with static TypeScript typing.

TypeParse Runtime object transformation, parsing and validation with inferred static TypeScript typing. Install Using npm npm install typeparse Using

May 5, 2022
Owner
Snowy
Backend engineer, mainly experienced in Javascript. Nuxt.js enthusiast ✨ Discord ━ Kaan K.#8484
Snowy
Send encrypted and decrypted messages with verifiable keys and human readable names.

zooko-msg Encrypt and decrypt messages using AES with a preshared ECDH key generated using keys associated with Handshake names. I noticed that there

Publius Federalist 31 Jul 27, 2022
⏱ Simple Alpine.js plugin to display the human-readable distance between a date and now.

⏱ Alpine TimeAgo ⏱ An Alpine.js plugin to return the distance between a given date and now in words (like "3 months ago", "about 2 hours ago" or "in a

Marc Reichel 47 Dec 22, 2022
Convert JSON to human readable HTML

json.human.js: Json Formatting for Human Beings A small library to convert a JSON object into a human readable HTML representation that is easy to sty

Mariano Guerra 955 Dec 3, 2022
parses human-readable strings for JavaScript's Temporal API

?? temporal-parse What is the temporal-parse? Temporal is the next generation of JavaScript's standard Date API. It's currently proposed to TC39 (see:

Eser Ozvataf 22 Jan 2, 2023
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Persistent key/value data storage for your Browser and/or PWA, promisified, including file support and service worker support, all with IndexedDB. Perfectly suitable for your next (PWA) app.

BrowstorJS ?? ?? ?? Persistent key/value data storage for your Browser and/or PWA, promisified, including file support and service worker support, all

Nullix 8 Aug 5, 2022
Promisified thunk with caching (pronounced "funky")

phunky phunky (promisified thunk, pronounced funky) is yet another thunk-inspired library, to delay a calculation until its result is needed, but also

Matt 2 Oct 14, 2022
Minimalistic configuration for TS to only extend JS with types. No TS features, no bundling. Readable maintainable code after compilation.

ts-guideline Minimalistic configuration for TS to only extend JS with types. No TS-scpecific features, no bundling. Readable maintainable code after c

Georg Oldenburger 41 Dec 22, 2022