{"id":17398494,"url":"https://github.com/vweevers/bruce-millis-option","last_synced_at":"2026-05-11T03:11:35.614Z","repository":{"id":66220528,"uuid":"282400200","full_name":"vweevers/bruce-millis-option","owner":"vweevers","description":"Convert various time formats to milliseconds and throw if result is NaN.","archived":false,"fork":false,"pushed_at":"2020-07-25T08:10:38.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-22T07:43:22.351Z","etag":null,"topics":["milliseconds","ms","nodejs","npm-package","time"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vweevers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-25T08:08:33.000Z","updated_at":"2020-07-25T08:10:41.000Z","dependencies_parsed_at":"2023-04-06T03:54:14.528Z","dependency_job_id":null,"html_url":"https://github.com/vweevers/bruce-millis-option","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"bcd6712a5326c400104e95bea52447063f7bf623"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/vweevers/bruce-millis-option","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fbruce-millis-option","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fbruce-millis-option/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fbruce-millis-option/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fbruce-millis-option/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vweevers","download_url":"https://codeload.github.com/vweevers/bruce-millis-option/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fbruce-millis-option/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32486222,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["milliseconds","ms","nodejs","npm-package","time"],"created_at":"2024-10-16T14:57:31.653Z","updated_at":"2026-05-11T03:11:35.579Z","avatar_url":"https://github.com/vweevers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bruce-millis-option\n\n**Convert various time formats to milliseconds and throw if result is `NaN`. Like [`bruce-millis`](https://github.com/vweevers/bruce-millis) but dies harder.**\n\n[![npm status](http://img.shields.io/npm/v/bruce-millis-option.svg)](https://www.npmjs.org/package/bruce-millis-option)\n[![node](https://img.shields.io/node/v/bruce-millis-option.svg)](https://www.npmjs.org/package/bruce-millis-option)\n[![Travis build status](https://img.shields.io/travis/com/vweevers/bruce-millis-option.svg?label=travis)](http://travis-ci.com/vweevers/bruce-millis-option)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Usage\n\n```js\nconst ms = require('bruce-millis-option')\n\nms(24)        // 24\nms('5s')      // 5000\nms('1m')      // 60000\nms('2h')      // 7200000\nms('2.5 hrs') // 9000000\nms('10h')     // 36000000\nms('1d')      // 86400000\nms('2 days')  // 172800000\nms('1y')      // 31557600000\nms('-3 days') // -259200000\nms('-1h')     // -3600000\n\nms('invalid') // throws TypeError\n```\n\n## API\n\n### `ms(value[, hint])`\n\nParses `value` with [`bruce-millis`](https://github.com/vweevers/bruce-millis), throws a TypeError if result is `NaN`. A `hint` may be provided to customize the error message:\n\n```js\nms(options.timeout, 'The timeout option')\n```\n\n```\n$ node example.js\n/example/node_modules/bruce-millis-option/index.js:11\n    throw new TypeError(\n    ^\n\nTypeError: The timeout option must be a number in milliseconds or a string with unit (e.g. '5m')\n    at module.exports (/example/node_modules/bruce-millis-option/index.js:11:11)\n    at Object.\u003canonymous\u003e (/example/example.js:2:1)\n    at ..\n```\n\n## Install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install bruce-millis-option\n```\n\n## License\n\n[MIT](LICENSE.md) © 2020-present Vincent Weevers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fbruce-millis-option","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvweevers%2Fbruce-millis-option","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fbruce-millis-option/lists"}