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.
Install katwercer using npm
, pnpm
, or yarn
:
npm install katwercer
pnpm install katwercer
yarn add katwercer
Import the convert function into your code:
import { convert } from 'katwercer';
Convert time strings into milliseconds:
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.
This project is licensed under the MIT License. See the LICENSE file for details.