1.0.3 β’ Published 12 months ago
css-time-converter v1.0.3
π css-time-converter
Convert CSS time values like '2s' or '500ms' into a standard millisecond number with ease.
Key Features:
- Simple Conversion: Effortlessly convert CSS time strings to milliseconds.
- Lightweight: Minimal code, maximum efficiency.
- Versatile: Supports both 's' (seconds) and 'ms' (milliseconds) formats.
π Installation
To install css-time-converter, run the following command:
npm install css-time-converter
π Getting Started
To get started, simply import the convert
function into your JavaScript or TypeScript project:
import convert from 'css-time-converter';
Then, use it to convert any CSS time string to milliseconds:
const durationInMs = convert('2s'); // 2000
πΈ Example
Hereβs a quick example of how to use css-time-converter in your code:
import convert from 'css-time-converter';
const animationDuration = '3.5s';
const durationInMs = convert(animationDuration);
console.log(`The duration in milliseconds is: ${durationInMs}`);
// Output: The duration in milliseconds is: 3500
π Why Choose css-time-converter?
- Accurate: Ensures consistent conversion of CSS time values.
- Easy to Use: Just one function to handle all your time conversion needs.
- Compact: Only a few lines of code, perfect for any project size.
π Supported Environments
css-time-converter is compatible with all modern browsers and Node.js environments.
π¨ Customization
The convert
function is designed to be straightforward and doesnβt require customization. It works out of the box to convert any valid CSS time string.
π§ Acknowledgments & Contributions
Feel free to fork, open issues, or submit pull requests to help improve this project.