{"_id":"@casperengl/ms","_rev":"2-1b7f169d14f614ed10d26a36b315414a","name":"@casperengl/ms","dist-tags":{"latest":"3.0.0-canary.1"},"versions":{"3.0.0-canary.1":{"name":"@casperengl/ms","version":"3.0.0-canary.1","description":"Tiny millisecond conversion utility","repository":{"type":"git","url":"git+https://github.com/vercel/ms.git"},"main":"./dist/index.cjs","type":"module","exports":{"import":"./dist/index.mjs","require":"./dist/index.cjs"},"module":"./dist/index.mjs","types":"./dist/index.d.ts","sideEffects":false,"license":"MIT","engines":{"node":">=12.13"},"scripts":{"test":"jest","build":"scripts/build.js","prepublishOnly":"npm run build","eslint-check":"eslint --max-warnings=0 .","prettier-check":"prettier --check .","type-check":"tsc --noEmit","precommit":"lint-staged","prepare":"husky install"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"prettier":{"endOfLine":"lf","tabWidth":2,"printWidth":80,"singleQuote":true,"trailingComma":"all"},"lint-staged":{"*":["prettier --ignore-unknown --write"],"*.{js,jsx,ts,tsx}":["eslint --max-warnings=0 --fix"]},"devDependencies":{"@types/jest":"27.0.1","@typescript-eslint/eslint-plugin":"4.31.0","@typescript-eslint/parser":"4.31.0","eslint":"7.32.0","eslint-config-prettier":"8.3.0","eslint-plugin-jest":"24.4.0","eslint-plugin-tsdoc":"0.2.14","husky":"7.0.2","jest":"27.1.1","lint-staged":"11.1.2","prettier":"2.4.0","ts-jest":"27.0.5","typescript":"4.4.2"},"gitHead":"1adfa5ee5007cacd6806e137a3f089d168869476","bugs":{"url":"https://github.com/vercel/ms/issues"},"homepage":"https://github.com/vercel/ms#readme","_id":"@casperengl/ms@3.0.0-canary.1","_nodeVersion":"14.17.6","_npmVersion":"6.14.15","dist":{"integrity":"sha512-bT0n8x9sWn3iBKrWRuUxEvNcTwAycuY2cgPfa7NVy8hEK/KSmgji/ImVqTHjQsPO9DR0a31Xdjfzk84Rfi5N1Q==","shasum":"53ab18d92ea9725dbd09d17a1e2cca730e74dcdc","tarball":"https://registry.npmjs.org/@casperengl/ms/-/ms-3.0.0-canary.1.tgz","fileCount":6,"unpackedSize":15726,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzbfiCRA9TVsSAnZWagAAfnQP/0MrR0yo2X1sOxp+NDYQ\nCoNWA1IsnDWJ/bMk0uXboJnzMfxwtgP82YjY34BChmQM/Cl2azAz/riHbdHu\njYQIRYXrvTuat1xf+KqfAGQ+jXV+VjxcsTJeRaNPgsoMO/nNJ9oxSyA1wSDW\nQkKEarDijTBRwyGqRHcjWh56TrT4pYPoShZrWYXyISKbUuZoLPx5bn0wOiis\nvlrLOMq4lwoYIyXW/zYRWFSQtelFZZ28NjRWFUj10d1xJmNcs9kDD8Ra+jZw\nQcAYhzz2fbZU9GlfwXZWBPuU4FFQ0B0HPlOjepV+xTjiKRKuItUFCh/K0ZP3\nmqMdqWA1XCOmLJGfHPv0FBEip4FHLTX2fNNYRD7AZN6bJlFYWKNgWmenEsS4\nT8p1dmgZxfidzNdEEjdkzi4DzLaTcj3eUZZF7s2WA2thYyEV9Mb7FQOoJ28A\nZ52rX3PiqkB7LyzyU0Y5KTIb1h3QToxhtlE8jJP4dnTN4aqsUjH4dnacS4s9\n3KbaOL/3b5YeIHtNXY8M7Ke7uGGNfy9JYNXBW4B6htncFKrWaHbgRU9arb6y\n9UC8idgBsqgM34dizaMk8TXGfv8C3fMMi9YEtm7TeZIG4ccQKRPmTQrHVHKl\nl1EsHiSFg60J4x+i8CLhvpd+fp/1Pk+MYpU+bwNni0Q2OwxrQmc9BnjQRF9P\nKF7o\r\n=qb8y\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBQ1mb4hPHoxJvy2TgLgdJbWCpjKfqh7EiA3RZE5rljaAiA9w+cqxM6jX6q3EgYQKKWEd5LzuB9LobuuwTlei3z8Tw=="}]},"_npmUser":{"name":"casperengl","email":"me@casperengelmann.com"},"directories":{},"maintainers":[{"name":"casperengl","email":"me@casperengelmann.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ms_3.0.0-canary.1_1632411707277_0.3526036917509048"},"_hasShrinkwrap":false}},"time":{"created":"2021-09-23T15:41:47.216Z","3.0.0-canary.1":"2021-09-23T15:41:47.511Z","modified":"2022-04-04T22:03:03.388Z"},"maintainers":[{"name":"casperengl","email":"me@casperengelmann.com"}],"description":"Tiny millisecond conversion utility","homepage":"https://github.com/vercel/ms#readme","repository":{"type":"git","url":"git+https://github.com/vercel/ms.git"},"bugs":{"url":"https://github.com/vercel/ms/issues"},"license":"MIT","readme":"# ms\n\n![CI](https://github.com/vercel/ms/workflows/CI/badge.svg)\n\nUse this package to easily convert various time formats to milliseconds.\n\n## Examples\n\n<!-- prettier-ignore -->\n```js\nms('2 days')  // 172800000\nms('1d')      // 86400000\nms('10h')     // 36000000\nms('2.5 hrs') // 9000000\nms('2h')      // 7200000\nms('1m')      // 60000\nms('5s')      // 5000\nms('1y')      // 31557600000\nms('100')     // 100\nms('-3 days') // -259200000\nms('-1h')     // -3600000\nms('-200')    // -200\n```\n\n### Convert from Milliseconds\n\n<!-- prettier-ignore -->\n```js\nms(60000)             // \"1m\"\nms(2 * 60000)         // \"2m\"\nms(-3 * 60000)        // \"-3m\"\nms(ms('10 hours'))    // \"10h\"\n```\n\n### Time Format Written-Out\n\n<!-- prettier-ignore -->\n```js\nms(60000, { long: true })             // \"1 minute\"\nms(2 * 60000, { long: true })         // \"2 minutes\"\nms(-3 * 60000, { long: true })        // \"-3 minutes\"\nms(ms('10 hours'), { long: true })    // \"10 hours\"\n```\n\n## Features\n\n- Works both in [Node.js](https://nodejs.org) and in the browser\n- If a number is supplied to `ms`, a string with a unit is returned\n- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)\n- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned\n\n## TypeScript support\n\nAs of v3.0, this package includes TypeScript definitions.\n\nFor added safety, we're using [Template Literal Types](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html) (added in [TypeScript 4.1](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-1.html)). This ensures that you don't accidentally pass `ms` values that it can't process.\n\nThis won't require you to do anything special in most situations, but you can also import the `StringValue` type from `ms` if you need to use it.\n\n```ts\nimport ms, { StringValue } from 'ms';\n\n// Using the exported type.\nfunction example(value: StringValue) {\n  ms(value);\n}\n\n// This function will only accept a string compatible with `ms`.\nexample('1 h');\n```\n\nIn this example, we use a [Type Assertion](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions) to coerce a `string`.\n\n```ts\nimport ms, { StringValue } from 'ms';\n\n// Type assertion with the exported type.\nfunction example(value: string) {\n  try {\n    // A string could be \"wider\" than the values accepted by `ms`, so we assert\n    // that our `value` is a `StringValue`.\n    //\n    // It's important to note that this can be dangerous (see below).\n    ms(value as StringValue);\n  } catch (error: Error) {\n    // Handle any errors from invalid vaues.\n    console.error(error);\n  }\n}\n\n// This function will accept any string, which may result in a bug.\nexample('any value');\n```\n\nYou may also create a custom Template Literal Type.\n\n```ts\nimport ms from 'ms';\n\ntype OnlyDaysAndWeeks = `${number} ${'days' | 'weeks'}`;\n\n// Using a custom Template Literal Type.\nfunction example(value: OnlyDaysAndWeeks) {\n  // The type of `value` is narrower than the values `ms` accepts, which is\n  // safe to use without coercion.\n  ms(value);\n}\n\n// This function will accept \"# days\" or \"# weeks\" only.\nexample('5.2 days');\n```\n\n## Related Packages\n\n- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.\n\n## Caught a Bug?\n\n1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device\n2. Link the package to the global module directory: `npm link`\n3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!\n\nAs always, you can run the tests using: `npm test`\n","readmeFilename":"readme.md"}