Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
humanize-ms
Advanced tools
The humanize-ms npm package is designed to convert various time formats into milliseconds. It is particularly useful for applications that need to handle and manipulate time intervals in a human-readable format and then convert them to milliseconds for processing or scheduling tasks.
Convert human-readable strings to milliseconds
This feature allows the conversion of a human-readable string like '2 days' into its equivalent in milliseconds. It is useful for setting timeouts, intervals, or calculating durations in applications.
const humanize = require('humanize-ms');
console.log(humanize('2 days')); // 172800000
Support for various time units
The package supports various time units such as hours, minutes, and seconds, allowing for flexible conversions depending on the needs of the application.
const humanize = require('humanize-ms');
console.log(humanize('1 hour')); // 3600000
console.log(humanize('30 seconds')); // 30000
Similar to humanize-ms, the 'ms' package provides utilities for converting various time formats into milliseconds and vice versa. It also allows for string representations like '1h' which humanize-ms supports. The 'ms' package is widely used and offers both parsing and formatting capabilities, making it slightly more versatile compared to humanize-ms.
The 'parse-duration' npm package is another alternative that converts human-readable duration strings into milliseconds. Unlike humanize-ms, parse-duration can handle a broader range of time formats and units, providing more flexibility for parsing complex duration expressions.
transform humanize time to ms
npm install humanize-ms
import { ms } from 'humanize-ms';
ms('1s') // 1000
ms(1000) // 1000
Made with contributors-img.
2.0.0 (2024-12-12)
https://github.com/eggjs/egg/issues/5257
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->New Features
Introduced a new function ms
for converting human-readable time
formats into milliseconds.
Added multiple GitHub Actions workflows for CI, testing, and publishing automation.
Bug Fixes
Removed outdated configuration files that could lead to linting errors or CI issues.
Documentation
Updated README.md
with new CI/CD references, installation
instructions, and contributor acknowledgments.
Chores
Updated package.json
with new dependencies and scripts for linting
and testing.
FAQs
transform humanize time to ms
The npm package humanize-ms receives a total of 6,379,392 weekly downloads. As such, humanize-ms popularity was classified as popular.
We found that humanize-ms demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.