Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/krr0ption/katwercer
https://github.com/krr0ption/katwercer
Last synced: 29 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/krr0ption/katwercer
- Owner: Krr0ptioN
- Created: 2023-07-26T09:47:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-27T09:20:25.000Z (over 1 year ago)
- Last Synced: 2024-12-08T01:48:59.457Z (about 2 months ago)
- Language: TypeScript
- Size: 108 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Katwercer
## Description
katwercer is a lightweight npm package that converts time strings into the equivalent number of milliseconds. It supports various time units such as years, months, weeks, days, hours, minutes, and seconds. The package provides a single function convert for easy and efficient parsing of time durations.
## Getting Started
### Installation
Install **katwercer** using `npm`, `pnpm`, or `yarn`:
#### npm
```sh
npm install katwercer
```#### pnpm
```sh
pnpm install katwercer
```#### yarn
```sh
yarn add katwercer
```### Usage
Import the convert function into your code:
```js
import { convert } from 'katwercer';
```Convert time strings into milliseconds:
```js
const timeString = '1h30m';
const milliseconds = convert(timeString);
console.log(milliseconds); // Output: 3600000 (1 hour in milliseconds)
```The time string can consist of any combination of time units, allowing
flexibility in defining durations.## License
This project is licensed under the MIT License. See the LICENSE file for details.