{"_id":"@caldwell619/ms","_rev":"3-3f34e3233fdf1929e0deeed9e55a6db5","name":"@caldwell619/ms","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"@caldwell619/ms","version":"0.0.1","description":"Tiny time formatting utility forked from vercel/ms","main":"dist/index.js","module":"dist/index.module.js","source":"src/index.ts","scripts":{"format":"prettier --write .","lint":"eslint ./ --ext .js,.ts","benchmark:ms":"ts-node benchmark/index.ts","test":"jest","type-check":"tsc --noEmit","build":"microbundle --compress --target node","release":"standard-version","publish-release":"git push --follow-tags origin master && yarn publish","deploy":"sh scripts/publish.sh"},"repository":{"type":"git","url":"git@github.com:christopher-caldwell/ms.git"},"bugs":{"url":"https://github.com/christopher-caldwell/ms/issues"},"keywords":["time","conversion","seconds","weeks","date"],"author":{"name":"u/christopher-caldwell"},"license":"MIT","devDependencies":{"@types/benchmark":"2.1.0","@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^2.33.0","@typescript-eslint/parser":"^2.33.0","benchmark":"2.1.4","colors":"1.4.0","eslint":"^7.20.0","eslint-plugin-prettier":"^3.3.1","jest":"26.6.3","microbundle":"^0.13.0","prettier":"^2.0.5","standard-version":"^9.1.1","ts-jest":"26.5.6","ts-node":"9.1.1","typescript":"^4.1.5"},"licenseText":"MIT License\n\nCopyright (c) 2021 GitHub user u/christopher-caldwell\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"@caldwell619/ms@0.0.1","dist":{"shasum":"8c045292fb1fa7d06675c222fa64c401c88f9f72","integrity":"sha512-J7ahyutMGAZdWd0orAPkRdmw5did79+DNVx6aPwTu5QhA8k9OrYyk63zjqTtCMvmYJVr5ag4wROiEsTewMzt9A==","tarball":"https://registry.npmjs.org/@caldwell619/ms/-/ms-0.0.1.tgz","fileCount":16,"unpackedSize":35133,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnvaXCRA9TVsSAnZWagAAx3wQAIJqvydsWdf5szS6ni+H\nNQuSrrHtf/zOwbR0XNASn1PkEI/hn5ap3PWBIr9p/ci77HN8FqUmlGCsub+0\nqszc9olcVGJZ2DMdJWHwkXCijso1bqxc+9ryX4+DGRyNZ9VTzXQCLzf8mk+d\nQBhfxCI/m5r9MjYa369DCQZrqKF8ECUqo2l3gtUQAgB+1ZqrxQtFBuRydPIo\n7FnGg+TGkVMUfRPyYlKl2xJl9hHcWi+QRTlIFeMLVeLDSF8Y5j9Quz2Bkagx\n8zKQtQRztzRwz1e27gBgqkekNnXEslIY7QmvLxQu4WawLtERFVe1WhAdQmfF\nw0xhautFSS9GiJesIpydp8rIcqRjqTFh0D0JeJHzrnIM+1kmESxuAK0cAgIo\nHmsEBkYVsdgWd2v9nGNl55Z9ZF9g8N2vZRXW0bgKT6A/HEVX0ryEBlYeOFrs\n63NkDi0tbADHD2OforjblQMDbeKWF+ltEISzAIXo0G/Rh6G48Zq7OjpTj2yG\nSkt5Up77c7m3xRX5qpu8BV8ueixt3F0kIAzIHpkAWAdE7ShEWJ02M1dUzK4M\nyxvIF1aQnerqhNZyptw7itZCqq6wNI4TWODeUf0sKnsCb5OCAEPGsejhcKzM\n1/PnnI+aeEuQZkssLnzNDIU4Ql2aKFRjypJGt5MCf7leMvHmhm1se9g+NpSk\nDjyf\r\n=KeFt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAUGGQzWW6ByFxSGEpu7EDS3aErUb14c7wz/pP+jP941AiEAvUIRLn1ILCo3H97btJ3/xFnjoyRM9G09CxLuQ1Q9d0A="}]},"_npmUser":{"name":"caldwell619","email":"caldwell8814@gmail.com"},"directories":{},"maintainers":[{"name":"caldwell619","email":"caldwell8814@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ms_0.0.1_1621030551230_0.4458904365836447"},"_hasShrinkwrap":false},"0.0.2":{"name":"@caldwell619/ms","version":"0.0.2","description":"Tiny time formatting utility forked from vercel/ms","main":"dist/index.js","module":"dist/index.module.js","source":"src/index.ts","scripts":{"format":"prettier --write .","lint":"eslint ./ --ext .js,.ts","benchmark:ms":"ts-node benchmark/index.ts","test":"jest","type-check":"tsc --noEmit","build":"microbundle --compress --target node","release":"standard-version","publish-release":"git push --follow-tags origin master && yarn publish","deploy":"sh scripts/publish.sh"},"repository":{"type":"git","url":"git@github.com:christopher-caldwell/ms.git"},"bugs":{"url":"https://github.com/christopher-caldwell/ms/issues"},"keywords":["time","conversion","seconds","weeks","date"],"author":{"name":"u/christopher-caldwell"},"license":"MIT","devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^2.33.0","@typescript-eslint/parser":"^2.33.0","colors":"1.4.0","eslint":"^7.20.0","eslint-plugin-prettier":"^3.3.1","jest":"26.6.3","microbundle":"^0.13.0","prettier":"^2.0.5","standard-version":"^9.1.1","ts-jest":"26.5.6","ts-node":"9.1.1","typescript":"^4.1.5"},"licenseText":"MIT License\n\nCopyright (c) 2021 GitHub user u/christopher-caldwell\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"@caldwell619/ms@0.0.2","dist":{"shasum":"818b6a07122e68513e1232ee4e1aad990d0a38f2","integrity":"sha512-QirLGLhFueuQUFzGXPLRtfYaj37vHYHM0GUFvk4UjcF+/CpR4B3hgJLuKcsDEw9ooR2mGSes8FOdBffhsdMM2g==","tarball":"https://registry.npmjs.org/@caldwell619/ms/-/ms-0.0.2.tgz","fileCount":17,"unpackedSize":53646,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgoGQDCRA9TVsSAnZWagAAJrkP/3MgiV1aeIiWAicLUZXS\nQCT3T4XuPRUNq20fbV6Sy+gJj0H/p0gyw7Tf5vkvsuAIQQrTuCBkwf/WzpH/\nmc+P1Mpf+xItCIy/CYpJW4oDSWbo1+yGXRnwHn4dzZkVnnu4XUIJJS4FjeHL\n6by2ng9dCsJZLdqM07EtLTl/WyYwNLRV5v1HJgdzXzjPRDMP9IuIrTYzS3dn\n/aXTe/Hyd4CpyC2BNZ8M9R57TlfMChxh3+zjgNbL5T9B3lOrYqMUsi4AC21k\n+vfUu/q+GgaW25H9wT2QczndvGSnD0Xk2Ts0TIJaOzd4J+AKE3R/0tYf/RMQ\n4B/KEt3bpKPZEWFjlNX/U2OZRgk5peiKDc/KXJAAyLaDcJXk+PtoEPd3DLdr\nIKW6I++t7TISmrXZaesjSvhTRefeXSkirv66UUAtclWhRgI8586aMxBoYJIT\nOlFD71ywzUB+NIQv/sM1088KtgqvbBR6V5pUoeBSLqzJpb4yj8Z6rnl5Mxun\ntuU3sNtR/86O6gwmJIL9FH3yDS8WtuAI7YQsEqVyGoZNUbT3UjWdij5PiZ51\nmiyIkMnxMTriTN/TV5Pa6bfZ8oGJNNtg8eOyo2RFTnOLYFqNHa3TBbdrPBdF\nZATNvWw/gBesXq8FNFOHKmwth8ecQaFcZ4V0HQog9RjWiRoEZpoMbPbqhAbR\nK/hf\r\n=BV/2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCkiX1TdcfAeDiDzmCgDxOQH7s2NmbpxRSlxNEyIQsmewIgXMIzSnk/MCz5C1sKlEKo/27y2I/PcVqforl5rM/30cs="}]},"_npmUser":{"name":"caldwell619","email":"caldwell8814@gmail.com"},"directories":{},"maintainers":[{"name":"caldwell619","email":"caldwell8814@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ms_0.0.2_1621124098989_0.5750729357542985"},"_hasShrinkwrap":false},"0.0.3":{"name":"@caldwell619/ms","version":"0.0.3","description":"Tiny time formatting utility forked from vercel/ms","main":"dist/index.js","module":"dist/index.module.js","source":"src/index.ts","scripts":{"format":"prettier --write .","lint":"eslint ./ --ext .js,.ts","benchmark:ms":"ts-node benchmark/index.ts","test":"jest","type-check":"tsc --noEmit","build":"microbundle --compress --target node","release":"standard-version","publish-release":"git push --follow-tags origin master && yarn publish","deploy":"sh scripts/publish.sh"},"repository":{"type":"git","url":"git@github.com:christopher-caldwell/ms.git"},"bugs":{"url":"https://github.com/christopher-caldwell/ms/issues"},"keywords":["time","conversion","seconds","weeks","date"],"author":{"name":"u/christopher-caldwell"},"license":"MIT","devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^2.33.0","@typescript-eslint/parser":"^2.33.0","colors":"1.4.0","eslint":"^7.20.0","eslint-plugin-prettier":"^3.3.1","jest":"26.6.3","microbundle":"^0.13.0","prettier":"^2.0.5","standard-version":"^9.1.1","ts-jest":"26.5.6","ts-node":"9.1.1","typescript":"^4.1.5"},"licenseText":"MIT License\n\nCopyright (c) 2021 GitHub user u/christopher-caldwell\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"@caldwell619/ms@0.0.3","dist":{"shasum":"5824b4c46d96a70c7085008a10984134f5c615ee","integrity":"sha512-Q+mKymogCJOw6FgZr+dHi299uv/7VDEB1ago6lbXInQ4Q64I4ayOp0b/6xn3sTyzkv9kuy4sAFW2c3GXlB+MAw==","tarball":"https://registry.npmjs.org/@caldwell619/ms/-/ms-0.0.3.tgz","fileCount":17,"unpackedSize":56028,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgoG6aCRA9TVsSAnZWagAAnZYQAJeEgu5sK7IpvpXMoIq+\nIegKXiFTO4hxKXrjgcfKFImqXRCX1IjsMYraw7fk8PNHJY92rI1LQyjIByhs\nvxOqZTsRJk9CxteqjtCRnyD0Dk3y5EDr6uSvDpgz/P1H8kASpn9KMM+ORGAo\nTHTuGdJEOqMxBIVyPoFgI7xAWn+HbnLQP/AtDzvaNYb7hCSu7bZ3AN/v35PH\noC6oif2VJjB3XyUZF/7iDwJXOQjLgZOs186ZjVOfpfg0EHuCAGveJtRzdsJ7\nnUXlM14prE/kOn+8oBC1BfGbwKZO1g5Bl8rbi8op43DugUxzJGcuVOE4mUhE\nQ47KMrg/dpOOUQCHl6xFUInAq3GkINLUhEEKUWLGoXz1/q+xP+C/DQh6+J7L\np8C6YtXbD2r8OQOpmnlo5/46RuucXqy3Ocq+oxHLT9wX2CCKHZkAanoyUyvZ\nnTFucdlEulQO5T3GWihaNKguqkGNL03wofVSFubzqCse6MpqCNIwn9pgkmLp\nd0BmbP5B2t7/iRMIzxQvvt3chKWlrozIAyD53rSvrqcsvIdzX7pto3I62R/i\n95GKhrnJHVMY0CQOWTSdp1ifuTxUXXGKQNB15haujiO1ayFd0ThwQPiMbKeZ\n49CNrgdpq1Mu5zI0XYRokwVZXSg3Y1ReiO8jNorP9dCHvZE2eD10/I3V6yXz\nFwmY\r\n=dNLr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCIY9+7O64XldRWItWbTrTfVGge/582gw9BcUib/mp00QIhAND2XjF98VFr0ErSs9ObUdXXgewjp6TLjH6gZd7EifJG"}]},"_npmUser":{"name":"caldwell619","email":"caldwell8814@gmail.com"},"directories":{},"maintainers":[{"name":"caldwell619","email":"caldwell8814@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ms_0.0.3_1621126810040_0.42795681949146847"},"_hasShrinkwrap":false}},"time":{"created":"2021-05-14T22:15:51.155Z","0.0.1":"2021-05-14T22:15:51.356Z","modified":"2022-04-04T21:31:52.115Z","0.0.2":"2021-05-16T00:14:59.129Z","0.0.3":"2021-05-16T01:00:10.238Z"},"maintainers":[{"name":"caldwell619","email":"caldwell8814@gmail.com"}],"description":"Tiny time formatting utility forked from vercel/ms","keywords":["time","conversion","seconds","weeks","date"],"repository":{"type":"git","url":"git@github.com:christopher-caldwell/ms.git"},"author":{"name":"u/christopher-caldwell"},"bugs":{"url":"https://github.com/christopher-caldwell/ms/issues"},"license":"MIT","readme":"# MS\n\nEasily convert various time formats to milliseconds, and milliseconds back to the formats.\nForked from [vercel/ms](https://github.com/vercel/ms)\n\n<p align=\"center\">\n  <h4/>\n  <a href='https://www.npmjs.com/package/@caldwell619/ms'>\n    <img src=\"https://img.shields.io/npm/v/@caldwell619/ms\">\n  </a>\n  <a href='https://bundlephobia.com/result?p=@caldwell619/ms'>\n    <img src=\"https://img.shields.io/bundlephobia/min/@caldwell619/ms\">\n  </a>\n  <img src=\"https://codecov.io/gh/christopher-caldwell/ms/branch/master/graph/badge.svg?token=2LA7ETDPO3\">\n  <img src=\"https://img.shields.io/github/last-commit/christopher-caldwell/ms\">\n  <img src=\"https://img.shields.io/npm/types/@caldwell619/ms\">\n</p>\n\n## Installation\n\n```bash\n# Yarn\nyarn add @caldwell619/ms\n\n# NPM\nnpm install --save @caldwell619/ms\n```\n\n## Usage\n\n2 main utilities are exposed:\n\n```ts\nimport { convertTimeToMs, convertMsToTime } from '@caldwell619/ms'\n```\n\nThe only required argument is the input to be converted.\n\nAccepted types are `string` | `number`\n\n### Converting logical units to milliseconds\n\n[Full list of supported units](#supported-units)\n\n```ts\nimport { convertTimeToMs } from '@caldwell619/ms'\n\nconvertTimeToMs('5s') // 5000\nconvertTimeToMs('1m') // 60000\nconvertTimeToMs('10h') // 36000000\nconvertTimeToMs('2 days') // 172800000\nconvertTimeToMs('1y') // 31557600000\nconvertTimeToMs('-1h') // -3600000\n```\n\n### Number as milliseconds\n\n```ts\nimport { convertMsToTime, convertTimeToMs } from '@caldwell619/ms'\n\nconvertMsToTime(60000) // \"1m\"\nconvertMsToTime(2 * 60000) // \"2m\"\nconvertMsToTime(-3 * 60000) // \"-3m\"\nconvertMsToTime(convertTimeToMs('10 hours')) // \"10h\"\n```\n\n#### Optional Configuration\n\nThe config is optional, as is every key in the config\n\n| Argument        | Type                                       |                                                       |\n| --------------- | ------------------------------------------ | ----------------------------------------------------- |\n| `long`          | `boolean`                                  | If present, will return the long version of the unit. |\n| `preferredUnit` | `'ms', 's', 'm', 'h', 'w', 'd', 'mo', 'y'` | The supported unit you'd like the value returned in.  |\n\n##### Long\n\nThis will print the value as `hours`, `minutes` as opposed to `h`, `m`.\n\n```ts\nconvertMsToTime(60000, { long: true }) // \"1 minute\"\nconvertMsToTime(2 * 60000, { long: true }) // \"2 minutes\"\nconvertMsToTime(-3 * 60000, { long: true }) // \"-3 minutes\"\nconvertMsToTime(convertTimeToMs('10 hours'), { long: true }) // \"10 hours\"\n```\n\n##### Preferred Unit\n\nThis is a working progress. It is implemented, but possibly not the way you'd like. Feel free to submit an [issue](https://github.com/christopher-caldwell/ms/issues/new) or [PR](https://github.com/christopher-caldwell/ms/compare) with how you'd like it done.\n\nIf provided, it will attempt to match the value with the given unit.\n\n###### Example\n\nFor example, if your value resolves to `15 days`, that is also `2 weeks`. The default will return as `2 weeks`. This is the largest bucket the time can be put into.\n\nThis can be overridden with providing your `preferredUnit`.\n\n```ts\nconvertMsToTime(7200000) // \"2h\"\nconvertMsToTime(7200000, { preferredUnit: 'm' }) // \"120m\"\nconvertMsToTime(7200000, { preferredUnit: 'm', long: true }) // \"120 minutes\"\n```\n\n###### Edge Cases\n\nIf your provided unit doesn't meet the requirement, meaning that the value cannot get to a full count of your unit, it will default to the next closest one.\n\n```ts\nconvertMsToTime(7200000) // \"2h\"\nconvertMsToTime(7200000, { preferredUnit: 'd' }) // \"2h\"\nconvertMsToTime(7200000, { preferredUnit: 'd', long: true }) // \"2 hours\"\n```\n\nIn this example, 2 hours cannot be represented as a `> 1 day`. This is where the funny business is, because maybe you'd prefer `0.08d` instead of defaulting to `2h`.\n\nMy preference is the latter, so :man_shrugging:\n\n## Supported Units\n\nThe following unites are supported for `convertTimeToMs`\n\n### Years\n\n`years`, `year`, `yrs`, `yr` `y`\n\n### Months\n\n`months`, `month`, `mon`, `mo`\n\n### Weeks\n\n`weeks`, `week`, `wks`, `wk`, `w`\n\n### Days\n\n`days`, `day`, `d`\n\n### Hours\n\n`hours`, `hour`, `hrs`, `hr`, `h`\n\n### Minutes\n\n`minutes`, `minute`, `mins`, `min`, `m`\n\n### Seconds\n\n`seconds`, `second`, `secs`, `sec`, `s`\n\n### Milliseconds\n\n`milliseconds`, `millisecond`, `msecs`, `msec`, `ms`\n","readmeFilename":"README.md"}