{"id":19780873,"url":"https://github.com/guyisra/mezur","last_synced_at":"2025-05-13T05:01:12.872Z","repository":{"id":49827920,"uuid":"127535689","full_name":"guyisra/mezur","owner":"guyisra","description":"Converting units of time, length, mass, pressure, angels, and more to anything, do anything. Well, not anything of that sort..","archived":false,"fork":false,"pushed_at":"2018-04-03T15:30:56.000Z","size":210,"stargazers_count":4,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T06:33:41.445Z","etag":null,"topics":["angles","area","conversion","convert","length","mass","measure","pressure","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/guyisra.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-31T13:44:44.000Z","updated_at":"2024-08-26T06:12:35.000Z","dependencies_parsed_at":"2022-08-25T15:40:52.529Z","dependency_job_id":null,"html_url":"https://github.com/guyisra/mezur","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guyisra%2Fmezur","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guyisra%2Fmezur/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guyisra%2Fmezur/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guyisra%2Fmezur/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guyisra","download_url":"https://codeload.github.com/guyisra/mezur/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253877509,"owners_count":21977643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["angles","area","conversion","convert","length","mass","measure","pressure","time"],"created_at":"2024-11-12T05:41:32.620Z","updated_at":"2025-05-13T05:01:12.839Z","avatar_url":"https://github.com/guyisra.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mezur\n\n\u003e Converting any measuring unit to any unit\n\n[![NPM Version][npm-image]][npm-url]\n[![Build Status][travis-image]][travis-url]\n[![Downloads Stats][npm-downloads]][npm-url]\n\nSometimes you want to convert hours to seconds. Something you want to know how many\nweeks are in a decade. And sometimes, you want to know how many blinks of an eye are in a day...\n\n## Installation\n\n```sh\nnpm install mezur --save\n```\n\n## Usage example\n\n```javascript\nconst time = require('mezur/time')\ntime.hours(5).inSeconds() // 18000\ntime.decades(1).inWeeks() // 521.4285714285714\n```\n\nAlso exposes the timeunit methods directly\n\n```javascript\nconst { hours, minutes } = require('mezur/time')\nhours(3).inDays() // 0.125\nminutes(60).inHours() // 1\n```\n\nAlso possible is `.asHours()` or `.toHours()`\n\nsame for\n\n```javascript\nrequire('mezur/angles')\nrequire('mezur/area')\nrequire('mezur/mass')\nrequire('mezur/length')\nrequire('mezur/pressure')\nrequire('mezur/time')\n```\n\n# There are other unit conversion packages, what gives?\n\nSome of the other packages only give you partial conversions (i.e. minutes to seconds) without anything else.\nSome are great, but are not complete, so you need several packages to \"collect the whole set\"\nSome are more \"complete\" but without an easy way to add more units.\n\nBuilding this is with intent to provide as much flexibility and extendability as possibly while keeping\nan easy-on-the-eyes usage, since you want to an easy and reliable API when converting, so it won't get in the way\nof your other important code. I believe that `hours(5).inSeconds()` do just that (to as much as javascript can give)\n# Supported Conversions\n## Acceleration \n\n|name|symbol|value|\n|----|----|----|\n|centigal|cgal|0.0001mpsps|\n|centigalileo|cgali|0.0001mpsps|\n|centimeterPerSecPerSec|cmpsps|0.01mpsps|\n|feetPerHourPerHour|ftphph|0.00000002351852mpsps|\n|feetPerHourPerMin|fphpmin|0.000001411mpsps|\n|feetPerHourSec|fphps|0.000084667mpsps|\n|feetPerMinPerMin|ftpmpm|0.000084667mpsps|\n|feetPerMinutePerSec|fpmps|0.00508mpsps|\n|feetPerSecPerSec|ftpsps|0.3048mpsps|\n|gUnits|gu|9.80665mpsps|\n|gal|gal|0.01mpsps|\n|galileo|gali|0.01mpsps|\n|gravity|g|9.80665mpsps|\n|inchPerHourPerHour|inphph|0.000000001959877mpsps|\n|inchPerHourPerMin|iphpm|0.0000001175926mpsps|\n|inchPerHourPerSecond|iphps|0.000007055556mpsps|\n|inchPerMinPerMin|inpmpm|0.000007055556mpsps|\n|inchPerMinPerSec|ipmps|0.000423333mpsps|\n|inchPerSecPerSec|inpsps|0.0254mpsps|\n|kilogal|kgal|10mpsps|\n|kilogalileo|kgali|10mpsps|\n|kilometerPerSecPerSec|kmpsps|1000mpsps|\n|knotsPerHour|knphph|0.0001429012mpsps|\n|knotsPerMillisec|knpmspms|514.444444444444mpsps|\n|knotsPerMin|knpmpm|0.00857407407407407mpsps|\n|knotsPerSec|knpsps|0.514444444444444mpsps|\n|metersPerHourPerHour|mphph|0.00000007716049mpsps|\n|metersPerMinPerMin|mpmpm|0.000277778mpsps|\n|metersPerSecPerSec|mpsps|1|\n|milePerHourPerHour|miphph|0.000124178mpsps|\n|milesPerMinPerMin|mipmpm|0.44704mpsps|\n|milesPerSecPerSec|mipsps|1609.344mpsps|\n|milligal|mgal|0.00001mpsps|\n|milligalileo |mgali|0.00001mpsps|\n|millimeterPerSecPerSec|mmpsps|0.001mpsps|\n\n\n## Angles \n\n|name|symbol|value|\n|----|----|----|\n|arcMinute|arcmin|1deg / 60|\n|arcSecond|arcsec|1deg / 3600|\n|degree|deg|1|\n|gradian|grad|0.9deg|\n|hourAngle|hrang|15deg|\n|milliradian|mrad|0.001rad|\n|quadrant|qd|90deg|\n|radian|rad|1deg * 180/3.141592653589793|\n|sextant|sxt|60deg|\n|turn|tr|360deg|\n\n\n## Area \n\n|name|symbol|value|\n|----|----|----|\n|acre|acre|4046.856430051sqm|\n|are|a|100sqm|\n|cent|cn|40.468564301sqm|\n|centiare|ca|0.1sqm|\n|decare|daa|100sqm|\n|deciare|da|10sqm|\n|hectare|ha|10000|\n|squareFeet|sqft|0.092903035sqm|\n|squareInch|sqin|0.00064516sqm|\n|squareKilometer|sqkm|1000000sqm|\n|squareMeter|sqm|1|\n|squareYard|sqy|.836127392sqm|\n\n\n## Length \n\n|name|symbol|value|\n|----|----|----|\n|centimeter|cm|0.01m|\n|feet|ft|12in|\n|inch|in|0.0254m|\n|kilometer|km|1000m|\n|meter|m|1|\n|micrometer|mcm|0.001mm|\n|mile|ml|1.609344km|\n|millimeter|mm|0.01cm|\n|nanometer|nm|0.001mcm|\n|nauticalMile|nml|1.852km|\n|yard|yard|0.9144m|\n\n\n## Mass \n\n|name|symbol|value|\n|----|----|----|\n|carat|ct|0.2g|\n|grain|gr|0.06479891g|\n|gram|g|1|\n|imperialTon|impT|1016.05kg|\n|jin|jin|0.002g|\n|kilogram|kg|1000g|\n|microgram|mcg|0.000001g|\n|milligram|mg|0.001g|\n|ounce|oz|28.349523125g|\n|pound|lb|453.59237g|\n|stone|st|6.35029318kg|\n|ton|T|1000000g|\n|usTon|usT|907.18474kg|\n\n\n## Pressure \n\n|name|symbol|value|\n|----|----|----|\n|atmosphere|atm|1.01325000bar|\n|bar|bar|1|\n|pascal|pas|0.00001bar|\n|psi|psi|0.06894757293bar|\n|torr|tr|0.001333223684bar|\n\n\n## Temperature \n\n|name|symbol|value|\n|----|----|----|\n|Celsius|C|1K + 273.15|\n|Delisle|D|(1K - 373.15) * (-3 / 2)|\n|Fahrenheit|F|(1K * 9 / 5) - 459.67|\n|Kelvin|K|1|\n|Newton|N|(1K - 273.15) * 33 / 100|\n|Rankine|R|1K * 9 / 5|\n\n\n## Time \n\n|name|symbol|value|\n|----|----|----|\n|century|C|10D|\n|day|d|24h|\n|decade|D|10Y|\n|gigasecond|Gs|31Y + 287d|\n|hectosecond|hs|1m + 40s|\n|hour|h|60m|\n|killosecond|ks|16m + 40s|\n|megasecond|Ms|11d + 13h + 46m + 40s|\n|millisecond|ms|0.001s|\n|minute|m|60s|\n|month|M|31d|\n|second|s|1|\n|terasecond|Ts|31600Y|\n|week|w|7d|\n|year|Y|365d|\n\n\n\n## Development setup\n\n```sh\nyarn install\nyarn test\n```\n\n## How to extend Mezur?\n\nLet's say you now landed on Mars, and obviously everything is in javascript because only hipsters live on Mars.\n\n```javascript\nconst marsUnits = [\n  {\n    name: 'martianDay', // or sol\n    symbol: 'marsd',\n    value: '24h + 39m + 35.244s'\n  },\n  {\n    name: 'martianYear',\n    symbol: 'marsY',\n    value: '668.5991marsd'\n  }\n]\n\nconst timeUnits = require('./units/time.json') // note that angles is a js file, so PI calculates will be accurate\n\nconst marsTime = require('mezur')(timeUnits.concat(marsUnits))\n\nmarsTime.martianYears(1).inMartianDays() // 668.5991\nmarsTime.martianYears(1).inSeconds() // 59355048.240680404\n```\n\n## Release History\n\nsee changelog.md\n\n## Meta\n\nGuy Israeli – [@isguyra](https://twitter.com/isguyra)\n\nDistributed under the MIT license. See `LICENSE` for more information.\n\n[https://github.com/guyisra/mezur](https://github.com/guyisra/mezur)\n\n## Contributing\n\n1.  Fork it (\u003chttps://github.com/guyisra/mezur\u003e)\n2.  Create your feature branch (`git checkout -b feature/fooBar`)\n3.  Commit your changes (`git commit -am 'Add some fooBar'`)\n4.  Push to the branch (`git push origin feature/fooBar`)\n5.  Create a new Pull Request\n\n\u003c!-- Markdown link \u0026 img dfn's --\u003e\n\n[npm-image]: https://img.shields.io/npm/v/mezur.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/mezur\n[npm-downloads]: https://img.shields.io/npm/dm/mezur.svg?style=flat-square\n[travis-image]: https://img.shields.io/travis/guyisra/mezur/master.svg?style=flat-square\n[travis-url]: https://travis-ci.org/guyisra/mezur\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguyisra%2Fmezur","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguyisra%2Fmezur","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguyisra%2Fmezur/lists"}