Skip to content

A collection of small to medium sized utils that don't fit into a package of their own.

License

Notifications You must be signed in to change notification settings

DCCSReschAndreas/utils

 
 

Repository files navigation

utils · travis build npm version

A collection of small to medium sized utils that don't fit into a package of their own.

@dccs/utils is written in Typescript and comes with its own type definitions.

Installation

You should install utils with npm or yarn:

npm install @dccs/utils
or
yarn add @dccs/utils

This command will download and install utils and all required dependencies.

Features

sleep

Retuns a Promise that resolves after ms milliseconds.

sleep(1000).then(() => console.log("after 1 second"));

// Or with the async syntax:
await sleep(1000);
console.log("after 1 second");

timespanToText

Returns a string representing the time that has passed between the two dates.

window.console.log(timeSpanToText(startDate, endDate));
Timespan Result
same hour 10:15 - 45 15.Dec.2020
same day 15:30 - 18:20 10.Jun.2019
same month 10 - 15.Dec.2022
same year 10.Nov - 5.Nov.2010
differnt year 10.Nov.2010 - 5.Jun.2011

Contributing

License

@dccs/utils is MIT licensed

About

A collection of small to medium sized utils that don't fit into a package of their own.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 92.6%
  • JavaScript 7.4%