npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mollahdev/slot-g

v1.0.0

Published

A time slot generator

Downloads

1

Readme

SlotG - Time Slot Generator

Available as an NPM Package.

Install with NPM:

npm i @mollahdev/slot-g

Generate time slots between a time range. Disable single/multiple specific slot. Get Formated/Non-formated time slot. Get dynamically gap slots.

Options

  • start: 0 -> starting minute
  • end: 1440 -> ending minutues (set 1440 for 24 hours)
  • gap: 30 -> each slot gap by minutes
  • ampm: true -> get am/pm as suffix
  • noTime: false -> enable when you need slots minitues only
  • disabled: [] -> [ [0, 480], [480, 600] ] nested array contains disabled slots [startMintues, endMinitues]
  • formatedHours: true -> get formated hours

Get full day slots by 30 minitues gap (Default)

import slotg from '@mollahdev/slot-g'

const slots = slotg();
console.log(slots)

// output
{
    "0": "12:00 AM",
    "30": "12:30 AM",
    "60": "01:00 AM",
    "90": "01:30 AM",
    ...
    "1380": "11:00 PM",
    "1410": "11:30 PM"
}

Get slots between 10am to 7pm by 45 minutes gap

import slotg from '@mollahdev/slot-g'

const slots = slotg({
	gap: 45, // set the gap by minutes
	start: 600, // 10 * 60
	end: 1140 // 19 * 60
});

console.log(slots)

// output
{
    "600": "10:00 AM",
    "645": "10:45 AM",
    "690": "11:30 AM",
    "735": "12:15 PM",
    "780": "01:00 PM",
    "825": "01:45 PM",
    "870": "02:30 PM",
    "915": "03:15 PM",
    "960": "04:00 PM",
    "1005": "04:45 PM",
    "1050": "05:30 PM",
    "1095": "06:15 PM"
}

Get slots between 10am to 7pm by 1 hour gap without counting 12pm to 3pm with no formated hours

import slotg from '@mollahdev/slot-g'

const slots = slotg({
	gap: 60,
	start: 600,
	end: 1140,
    disabled: [ [720, 900] ],
    formatedHours: false,
});

console.log(slots)

// output
{
    "600": "10:00 AM",
    "660": "11:00 AM",
    "900": "15:00 PM",
    "960": "16:00 PM",
    "1020": "17:00 PM",
    "1080": "18:00 PM"
}