{
  "_id": "@lukeed/ms",
  "maintainers": [
    {
      "name": "lukeed",
      "email": "luke@lukeed.com"
    }
  ],
  "keywords": [
    "ms",
    "time",
    "format",
    "milliseconds",
    "convert"
  ],
  "dist-tags": {
    "latest": "2.0.2"
  },
  "author": {
    "name": "Luke Edwards",
    "email": "luke.edwards05@gmail.com",
    "url": "https://lukeed.com"
  },
  "_rev": "4-f183205a881839f24b28fca8ea71bd1d",
  "description": "A tiny (414B) and fast utility to convert milliseconds to and from strings.",
  "readme": "# ms [![CI](https://github.com/lukeed/ms/workflows/CI/badge.svg)](https://github.com/lukeed/ms/actions) [![codecov](https://badgen.net/codecov/c/github/lukeed/ms)](https://codecov.io/gh/lukeed/ms)\n\n> A tiny (414B) and [fast](#benchmarks) utility to convert milliseconds to and from strings.\n\n---\n\n***NOTICE:** This is a fork of [vercel/ms](https://github.com/vercel/ms)!*<br>\nIn June 2019, I [opened a PR](https://github.com/zeit/ms/pull/120) with signficiant performance and code size improvements. After nearly 2 years of silence, it was eventually closed. :cry: A year into my wait, I started anew (this repo), hoping to improve upon my own improvements.\n\n---\n\nThis module is delivered as:\n\n* **CommonJS**: [`dist/index.js`](https://unpkg.com/@lukeed/ms/dist/index.js)\n* **ES Module**: [`dist/index.mjs`](https://unpkg.com/@lukeed/ms/dist/index.mjs)\n* **UMD**: [`dist/index.min.js`](https://unpkg.com/@lukeed/ms/dist/index.min.js)\n\n## Install\n\n```\n$ npm install --save @lukeed/ms\n```\n\n\n## Usage\n\n```js\nimport { parse, format } from '@lukeed/ms';\n\n// string => number\nparse('2 days');   //=> 172800000\nparse('1d');       //=> 86400000\nparse('10h');      //=> 36000000\nparse('2.5 hrs');  //=> 9000000\nparse('2h');       //=> 7200000\nparse('1m');       //=> 60000\nparse('5s');       //=> 5000\nparse('1y');       //=> 31557600000\nparse('100');      //=> 100\nparse('-3 days');  //=> -259200000\nparse('-1h');      //=> -3600000\nparse('-200');     //=> -200\n\n// number => string\nformat(60000);             //=> '1m'\nformat(2 * 60000);         //=> '2m'\nformat(-3 * 60000);        //=> '-3m'\nformat(parse('10 hours')); //=> '10h'\n\n// number => string (long)\nformat(60000, true);             //=> '1 minute'\nformat(2 * 60000, true);         //=> '2 minutes'\nformat(-3 * 60000, true);        //=> '-3 minutes'\nformat(parse('10 hours'), true); //=> '10 hours'\n```\n\n\n## API\n\n### ms.parse(input)\nReturns: `Number`\n\nParses the input string, returning the number of milliseconds.\n\n#### input\nType: `String`\n\nThe human-readable time string; eg: `10min`, `10m`, `10 minutes`.\n\n\n### ms.format(milli, long?)\nReturns: `Number`\n\nFormats the millisecond count to a human-readable time string.\n\n> **Important:** The output will be rounded to the nearest whole integer.\n\n#### milli\nType: `Number`\n\nThe number of milliseconds.\n\n#### long\nType: `Boolean`<br>\nDefault: `false`\n\nWhether or not the output should use the interval's long/full form; eg `hour` or `hours` instead of `h`.\n\n> **Note:** When `long`, the count and interval will be separated by a single space.<br>Also, when `long`, the interval may be pluralized; eg `1 second` vs `2 seconds`.\n\n\n## Benchmarks\n\n> Running on Node.js v12.18.4\n\n```\nValidation :: parse\n  ✔ lukeed/ms\n  ✔ zeit/ms\n\nBenchmark :: \"parse\"\n  lukeed/ms      x 351,319 ops/sec ±0.31% (96 runs sampled)\n  zeit/ms        x 245,576 ops/sec ±1.66% (94 runs sampled)\n\nBenchmark :: \"parse\" (long)\n  lukeed/ms      x 335,538 ops/sec ±0.50% (94 runs sampled)\n  zeit/ms        x 265,410 ops/sec ±1.72% (95 runs sampled)\n\n\nValidation :: format\n  ✔ lukeed/ms\n  ✔ zeit/ms\n\nBenchmark :: \"format\"\n  lukeed/ms      x 4,109,440 ops/sec ±0.35% (94 runs sampled)\n  zeit/ms        x 3,420,198 ops/sec ±1.61% (94 runs sampled)\n\nBenchmark :: \"format\" (long)\n  lukeed/ms      x 3,402,872 ops/sec ±0.14% (97 runs sampled)\n  zeit/ms        x 1,344,908 ops/sec ±3.68% (96 runs sampled)\n```\n\n\n## Credits\n\nThis is obviously a fork of [zeit/ms](https://github.com/zeit/ms).\n\nI opened a [PR in June 2019](https://github.com/zeit/ms/pull/120) that introduced significant performance gains and code reduction &mdash; it was ignored for nearly two years. This repository is a from-scratch re-implementation that takes the goals of that PR a bit further.\n\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/lukeed/ms.git"
  },
  "bugs": {
    "url": "https://github.com/lukeed/ms/issues"
  },
  "license": "MIT",
  "versions": {
    "1.0.0": {
      "version": "1.0.0",
      "name": "@lukeed/ms",
      "repository": {
        "type": "git",
        "url": "git+https://github.com/lukeed/ms.git"
      },
      "description": "A tiny (408B) and fast utility to convert milliseconds to and from strings.",
      "unpkg": "dist/index.min.js",
      "module": "dist/index.mjs",
      "main": "dist/index.js",
      "types": "ms.d.ts",
      "license": "MIT",
      "author": {
        "name": "Luke Edwards",
        "email": "luke.edwards05@gmail.com",
        "url": "https://lukeed.com"
      },
      "engines": {
        "node": ">=8"
      },
      "scripts": {
        "build": "bundt",
        "pretest": "npm run build",
        "test": "tape -r esm test/*.js | tap-spec"
      },
      "keywords": [
        "ms",
        "time",
        "format",
        "milliseconds",
        "convert"
      ],
      "devDependencies": {
        "bundt": "1.0.0",
        "esm": "3.2.25",
        "tap-spec": "5.0.0",
        "tape": "4.9.1"
      },
      "gitHead": "a6bb04bdd31c46cd6b6c927d9dfd10d3b94095d2",
      "bugs": {
        "url": "https://github.com/lukeed/ms/issues"
      },
      "homepage": "https://github.com/lukeed/ms#readme",
      "_id": "@lukeed/ms@1.0.0",
      "_npmVersion": "6.4.1",
      "_nodeVersion": "10.13.0",
      "_npmUser": {
        "name": "lukeed",
        "email": "luke@lukeed.com"
      },
      "dist": {
        "integrity": "sha512-98Rlnyqp9w3rY/ErihFZ8am4WTrhqsthktQ7Tf2BUQQquaEVu2mUMdhzBhtG02AZfTcLY3ZfFR1FG7VfPNgJdA==",
        "shasum": "dea9fa553c8119e108ee7aa6e563e49abe6d3e10",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/@lukeed/ms/-/ms-1.0.0.tgz",
        "fileCount": 7,
        "unpackedSize": 9221,
        "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeb8XXCRA9TVsSAnZWagAAjG4P/3f9BKyYA6nQrnVDWxdJ\nV9iNu0ILzhsjzudqXEh9wigOJV3fgRpwon9+RPfaYbRXtep+2rQd4KejhLmn\na7sI4DF5smajmtB9MKB8a1CZK4xUATK96bzcc4b0l0sVFpjY8NX0aKLvYf6H\nf3sMxoJ5cIfMZxv1YNvTUTPlVqfFEfftoPuY35vuG4RSdkFhrG1SoxxzQj4C\nTBb/+ISjUiwc5md9TmDLyIpapVKkvn6VKr9cRG0jTZ9IKmmMHSKBMRX2FHuB\nfzaEOB93X/pSutZFxJVs9shLLwN8Gpm2W/vjaCFSwflPdeYVQTzlOyXuCLnN\nfP4B+7jr0AJjfJZmRk56YsilZRRY5IdI63rWCjQlXEr7EDXm+Sb5RayEGURY\nRx1E19EIQ+vop+1oCt96if+VXw0Co0WTh+qkqIRSm2F1STkm57lQICm8Mjtz\nQS+a7RrpT+sB5XJKaoAWXRwNRBJQrxduoNbDI3zk/r0Gm7JAP9fUKW0U0/66\nUcDeAIcFcsScSXhGPlOmNGW4fg/n0n51TtPMHSBazfuDytu7abOw1BS3VtcE\njZQqif9e+6uQ93QndXvdjTgxjDecG+gvFI3CvyzXglySoExQmX4rg0TcFF4o\ncU6JeNmQ4EIiVdn9wstoFY0pKxt/QI6Gmb7xRFsT8yiBFV9Pr1eNWryHcwtC\nKGO6\r\n=n8zu\r\n-----END PGP SIGNATURE-----\r\n",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEQCIAPFPvoUNsIZ+50NEeZKj2dNIrar8I0FdRM47c3hmC09AiAPd26WEiW5LhsJI0k0m3szU9NvufAe2ZX5MhC4w3p+ng=="
          }
        ]
      },
      "maintainers": [
        {
          "name": "lukeed",
          "email": "luke@lukeed.com"
        }
      ],
      "directories": {},
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/ms_1.0.0_1584383447474_0.2580366446969"
      },
      "_hasShrinkwrap": false
    },
    "2.0.0": {
      "umd:name": "ms",
      "version": "2.0.0",
      "name": "@lukeed/ms",
      "repository": {
        "type": "git",
        "url": "git+https://github.com/lukeed/ms.git"
      },
      "description": "A tiny (414B) and fast utility to convert milliseconds to and from strings.",
      "unpkg": "dist/index.min.js",
      "module": "dist/index.mjs",
      "main": "dist/index.js",
      "types": "index.d.ts",
      "license": "MIT",
      "author": {
        "name": "Luke Edwards",
        "email": "luke.edwards05@gmail.com",
        "url": "https://lukeed.com"
      },
      "exports": {
        ".": {
          "import": "./dist/index.mjs",
          "require": "./dist/index.js"
        },
        "./package.json": "./package.json"
      },
      "engines": {
        "node": ">=8"
      },
      "scripts": {
        "build": "bundt",
        "test": "uvu -r esm test"
      },
      "keywords": [
        "ms",
        "time",
        "format",
        "milliseconds",
        "convert"
      ],
      "devDependencies": {
        "bundt": "1.1.2",
        "esm": "3.2.25",
        "uvu": "0.5.1"
      },
      "gitHead": "b2d295408f18bfd47a43ebf4de5e6ce21468e7d0",
      "bugs": {
        "url": "https://github.com/lukeed/ms/issues"
      },
      "homepage": "https://github.com/lukeed/ms#readme",
      "_id": "@lukeed/ms@2.0.0",
      "_nodeVersion": "12.18.4",
      "_npmVersion": "6.14.6",
      "dist": {
        "integrity": "sha512-NOlhE40rGptwLwJhE0ZW259hcoa+nkpQRQ1FUKV4Sr2z1Eh2WfkHQ3jjBNF7YEqOrF0TOpqnyU1wClvWBrXByg==",
        "shasum": "cacd4fcb81b1b285f21f8c7e3650874ef9383f1b",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/@lukeed/ms/-/ms-2.0.0.tgz",
        "fileCount": 7,
        "unpackedSize": 9347,
        "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgPyo+CRA9TVsSAnZWagAAI5oP/RLdJjjSsP1yIrAqcLR2\nUUYwWuTRKXUNTRifIzowOcJ6cQqHsbwjPIUnEXRFaYqk32JTo6AMtqvHnKex\nKgH7w6NkSnd7+RJIen1o+kHEwWmJBcoI28w5ahYYszydmgP/DD4sOcpvhOQM\nrTEPJahxhRRAfshhShQFdbLjxZ9NbC2nZN5G6j7tuZ1rTxYGvHszq1DXInRn\nFQbJWeDT/Lxp6Yptjv0GUz9GhzadE0P6en65y9nGE8EYm2kKRXRSksmk3h+7\nCK9MsjAaCXukmJXufer9vq+J0jrXtMsLIGuCt/TAynxpkHEUgbKicEfGgQQ4\nz6q3OEbSHTSbS7P7iv4NMNv965SFCQsOFejSuWoNi4qx184e0Bxl5Bv4ZR5D\ncWVS2kakXzF2m5Fx4LU8h5/YBidd1TW00RJmPikxfHQOtCEXgqHB/DKw8o4B\nIu2QlGWUH+CWo2Nfu34cVQtaN29ytljA9gwXxxN53Kt1MtV9e9LwcTJB+Jvn\n1nb/8PfbaoZP0ZT+Vhh+DjmbAjsH81uGv1Y8k9xPynjtGoS6fT16LGUiwhf5\n6UZHm0L1UOtdPwrSFiQ8MQl/I/59jomNS7UTIyH5NjpvJIt5DXEXqy1ThBQR\nZuh1xBNaxMqv+f4et4LKaUA3+x0utCoGw75D+ATX+BChzVpbL0N9igaCXXsw\nHJs/\r\n=T5Qp\r\n-----END PGP SIGNATURE-----\r\n",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEYCIQDdzh+fmTc3wPHcZQO78G3+eJ4bwhMowMPDsFn7BA22ZwIhAKpcKOuDtHLMaUhNbQBFnIlsDXY/q++hbPDg4emQLS0v"
          }
        ]
      },
      "_npmUser": {
        "name": "lukeed",
        "email": "luke@lukeed.com"
      },
      "directories": {},
      "maintainers": [
        {
          "name": "lukeed",
          "email": "luke@lukeed.com"
        }
      ],
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/ms_2.0.0_1614752318451_0.8486867137091219"
      },
      "_hasShrinkwrap": false
    },
    "2.0.1": {
      "umd:name": "ms",
      "version": "2.0.1",
      "name": "@lukeed/ms",
      "repository": {
        "type": "git",
        "url": "git+https://github.com/lukeed/ms.git"
      },
      "description": "A tiny (414B) and fast utility to convert milliseconds to and from strings.",
      "unpkg": "dist/index.min.js",
      "module": "dist/index.mjs",
      "main": "dist/index.js",
      "types": "index.d.ts",
      "license": "MIT",
      "author": {
        "name": "Luke Edwards",
        "email": "luke.edwards05@gmail.com",
        "url": "https://lukeed.com"
      },
      "exports": {
        ".": {
          "types": "./index.d.ts",
          "import": "./dist/index.mjs",
          "require": "./dist/index.js"
        },
        "./package.json": "./package.json"
      },
      "engines": {
        "node": ">=8"
      },
      "scripts": {
        "build": "bundt",
        "test": "uvu -r esm test"
      },
      "keywords": [
        "ms",
        "time",
        "format",
        "milliseconds",
        "convert"
      ],
      "devDependencies": {
        "bundt": "1.1.2",
        "esm": "3.2.25",
        "uvu": "0.5.1"
      },
      "gitHead": "e8001e5e5bf7d41450e86a72a2b0dbdc4c1e7d29",
      "bugs": {
        "url": "https://github.com/lukeed/ms/issues"
      },
      "homepage": "https://github.com/lukeed/ms#readme",
      "_id": "@lukeed/ms@2.0.1",
      "_nodeVersion": "18.8.0",
      "_npmVersion": "8.18.0",
      "dist": {
        "integrity": "sha512-Xs/4RZltsAL7pkvaNStUQt7netTkyxrS0K+RILcVr3TRMS/ToOg4I6uNfhB9SlGsnWBym4U+EaXq0f0cEMNkHA==",
        "shasum": "3c2bbc258affd9cc0e0cc7828477383c73afa6ee",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/@lukeed/ms/-/ms-2.0.1.tgz",
        "fileCount": 7,
        "unpackedSize": 9382,
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEYCIQDIGhhBLkDd2rtpHBoqsgub3fEmpjxxkUumk+FYQcyc1QIhAMnYzRlFzTh/cLBWKebUMnF97Gt36+IjZw1q5/UCGdAR"
          }
        ],
        "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjNb9AACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrwthAAm9ONfRBZfbldxno9vSqAJD8A04ixRzULKnriBZeejLe0Zjtg\r\n4wJVyVrKgskc/JjP7F4NIyqc+dIaqsurXfuE3bsrpgNLZiQr46xQu/3vF0Pd\r\nr8xXTiw7zvBDSCSUzkOfLFydhRuI8vv6ZKBQUU2GLFy+KzQ0vn1LDBhGjlxN\r\nhLBjUdxCokKUtDJVJmor8Udie8SLPz0nLCIY1hM4Cc8hM/g/YxpZguCkxmdd\r\nKzB7OKsJ25YIhb0Oh+DMYKPnvE71mRl7bZbnPX4Xiwiid9nGOldBq25uBbET\r\niTNK2raixF/Lyf6xIku2RIdcnmAyXWMyz5EJ5++L4nrnHApF7aJHp1RbhN+3\r\nQX0Hb/gGTCSoIWLTjaoXSQklyPSsn23OuWOz4U8j/BD2T6npA9qODwmaXzkJ\r\njDMV7042bkmblAaUMCkQK/lYRqaZpJiX4Ixlv8RKKShPxZaaaRd2VcmS5ZOX\r\n9XlxaNikg+JhvcdCjrjv65CUj0r2PNyp81/oxLjuiePZtUlzbR/0L00yhofc\r\n7A1FlicO5vh/5na5GWVvhCL1VNm/OZEGkK+LocC5vsdCXBWF7xL+l+rh7+JF\r\nlhMrOLbfKvmu7xVG96qOlHXwhaPZftzQvfjmK7LoaUhMr1nqLN2KF0bE0Q99\r\nJIsz2/xWPnapJ2hGCkXM+Y/eo/PDA5mhgfw=\r\n=jxod\r\n-----END PGP SIGNATURE-----\r\n"
      },
      "_npmUser": {
        "name": "lukeed",
        "email": "luke@lukeed.com"
      },
      "directories": {},
      "maintainers": [
        {
          "name": "lukeed",
          "email": "luke@lukeed.com"
        }
      ],
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/ms_2.0.1_1664466752625_0.5926763898678358"
      },
      "_hasShrinkwrap": false
    },
    "2.0.2": {
      "umd:name": "ms",
      "version": "2.0.2",
      "name": "@lukeed/ms",
      "repository": {
        "type": "git",
        "url": "git+https://github.com/lukeed/ms.git"
      },
      "description": "A tiny (414B) and fast utility to convert milliseconds to and from strings.",
      "unpkg": "dist/index.min.js",
      "module": "dist/index.mjs",
      "main": "dist/index.js",
      "types": "index.d.ts",
      "license": "MIT",
      "author": {
        "name": "Luke Edwards",
        "email": "luke.edwards05@gmail.com",
        "url": "https://lukeed.com"
      },
      "exports": {
        ".": {
          "types": "./index.d.ts",
          "import": "./dist/index.mjs",
          "require": "./dist/index.js"
        },
        "./package.json": "./package.json"
      },
      "engines": {
        "node": ">=8"
      },
      "scripts": {
        "build": "bundt",
        "test": "uvu -r esm test"
      },
      "keywords": [
        "ms",
        "time",
        "format",
        "milliseconds",
        "convert"
      ],
      "devDependencies": {
        "bundt": "1.1.2",
        "esm": "3.2.25",
        "uvu": "0.5.1"
      },
      "_id": "@lukeed/ms@2.0.2",
      "gitHead": "ea01baec0cc2ae2aa7679a7f08ea4b4ee5f9b3e3",
      "bugs": {
        "url": "https://github.com/lukeed/ms/issues"
      },
      "homepage": "https://github.com/lukeed/ms#readme",
      "_nodeVersion": "20.8.1",
      "_npmVersion": "10.1.0",
      "dist": {
        "integrity": "sha512-9I2Zn6+NJLfaGoz9jN3lpwDgAYvfGeNYdbAIjJOqzs4Tpc+VU3Jqq4IofSUBKajiDS8k9fZIg18/z13mpk1bsA==",
        "shasum": "07f09e59a74c52f4d88c6db5c1054e819538e2a8",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/@lukeed/ms/-/ms-2.0.2.tgz",
        "fileCount": 7,
        "unpackedSize": 9387,
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEUCIQCNf5qD0XnQ+6wv78+HLB1wJUMygQxwUAcm1yP2LdOGswIgJhnZi6yhejmZvRfnOc0EZ/i+7+1wcJJPA64H46kHxD4="
          }
        ]
      },
      "_npmUser": {
        "name": "lukeed",
        "email": "luke@lukeed.com"
      },
      "directories": {},
      "maintainers": [
        {
          "name": "lukeed",
          "email": "luke@lukeed.com"
        }
      ],
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/ms_2.0.2_1701211032846_0.09698399356929066"
      },
      "_hasShrinkwrap": false
    }
  },
  "name": "@lukeed/ms",
  "time": {
    "created": "2020-03-16T18:30:47.238Z",
    "1.0.0": "2020-03-16T18:30:47.558Z",
    "modified": "2026-06-26T22:15:46.230Z",
    "2.0.0": "2021-03-03T06:18:38.590Z",
    "2.0.1": "2022-09-29T15:52:32.797Z",
    "2.0.2": "2023-11-28T22:37:13.145Z"
  },
  "readmeFilename": "readme.md",
  "homepage": "https://github.com/lukeed/ms#readme"
}