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

make-time-slot

v1.0.8

Published

## 何をするライブラリなのか?

Downloads

36

Readme

make-time-slot

何をするライブラリなのか?

開始時刻と終了時刻、時間刻みを渡すと配列が返ってきます。

ex: 900, 1000, 30 -> 900, 930, 1000

ex2: 1000, 1100, 15 -> 1000, 1015, 1030, 1045, 1100

タイムスケジュール表をつくるときに便利なライブラリです。

installation

npm i make-time-slot
or
yarn add make-time-slot
or
pnpm add make-time-slot

usage(使い方)

開始時刻、終了時刻をnumberにします。 (例:10時00分であれば1000。8時15分であれば815など) beginTime, endTime is number type. example:10:00 -> 1000

刻みの分数をnumberにします。 (例:30分刻みであれば30) step is number type;

import { makeTimeSlot } from "make-time-slot";
const beginTime = 1000;
const endTime = 1100;
const step = 30;

const timeSlots:number[] = makeTimeSlot(beginTime, endTime, step);
// [1000, 1030, 1100]

もし1000を10:00に変更したいときはconvertHHColonmm関数で変換を行います。

const timeSlots:number[] = makeTimeSlot(900, 1000, 15);
//[900, 915, 930, 945, 1000]
const timeSlotsHHmm:string[] = convertHHColonmm(timeNum);
//['09:00', '09:15', '09:30', '09.45', '10:00']

もし最後の数字がいらない場合(未満で良い場合は最後にbooleanを渡せます。 isLtなのでLess than,未満かどうかのbooleanです。 trueを渡すと10時未満になるので10時の1個前で終わります。 まあstepの15を引いた945を渡せばいいのですが計算が面倒くさい人向け。

const timeSlots:number[] = makeTimeSlot(900, 1000, 15, true);
//[900, 915, 930, 945]