{"id":21839216,"url":"https://github.com/alibasiccoder/convert-pro","last_synced_at":"2025-09-02T17:46:34.695Z","repository":{"id":57206839,"uuid":"406094659","full_name":"AliBasicCoder/convert-pro","owner":"AliBasicCoder","description":"a js library to convert between units that works on browser, node \u0026 deno","archived":false,"fork":false,"pushed_at":"2021-10-08T23:20:06.000Z","size":53,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T09:04:32.938Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/AliBasicCoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2021-09-13T18:59:38.000Z","updated_at":"2024-07-17T16:00:45.000Z","dependencies_parsed_at":"2022-09-08T14:22:35.620Z","dependency_job_id":null,"html_url":"https://github.com/AliBasicCoder/convert-pro","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliBasicCoder%2Fconvert-pro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliBasicCoder%2Fconvert-pro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliBasicCoder%2Fconvert-pro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliBasicCoder%2Fconvert-pro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AliBasicCoder","download_url":"https://codeload.github.com/AliBasicCoder/convert-pro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248863550,"owners_count":21174026,"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":[],"created_at":"2024-11-27T21:16:40.897Z","updated_at":"2025-04-14T10:35:37.498Z","avatar_url":"https://github.com/AliBasicCoder.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# convert-pro\n\n[![nest badge](https://nest.land/badge-large.svg)](https://nest.land/package/convert-pro)\n[![npm](https://img.shields.io/npm/dm/convert-pro)](https://npmjs.com/package/convert-pro)\n[![npm](https://img.shields.io/npm/v/convert-pro)](https://npmjs.com/package/convert-pro)\n\n[![GitHub issues](https://img.shields.io/github/issues/AliBasicCoder/convert-pro)](https://github.com/AliBasicCoder/convert-pro/issues)\n[![GitHub forks](https://img.shields.io/github/forks/AliBasicCoder/convert-pro)](https://github.com/AliBasicCoder/convert-pro/network)\n[![GitHub stars](https://img.shields.io/github/stars/AliBasicCoder/convert-pro)](https://github.com/AliBasicCoder/convert-pro/stargazers)\n[![GitHub license](https://img.shields.io/github/license/AliBasicCoder/convert-pro)](https://github.com/AliBasicCoder/convert-pro/blob/master/LICENSE)\n\nconvert-pro is a package to convert between units that works on browser, node \u0026 deno\n\ncovers:\n\n- temperature\n- length\n- area\n- volume\n- time\n- mass\n- energy\n- frequency\n- pressure\n- degrees\n- bytes\n\n## Usage\n\n```js\n// on node (commonjs)\nconst { default: convert } = require(\"convert-pro\");\n// or (es6)\nimport convert from \"convert-pro\";\n// on deno (replace version with current version)\nimport convert from \"https://x.nest.land/convert-pro@version/mod.ts\";\n// or\nimport convert from \"https://deno.land/x/convert_pro@version/mod.ts\";\n\n// convert from m2 to cm2\nconvert.area(\"10 m2\", \"cm2\"); // =\u003e 100000\n// convert from bit to MiB (1024 base)\nconvert.bytes([10 ** 15, \"bit\"], \"MiB\"); // =\u003e 119209289.55078125\n// convert degrees to rad\nconvert.bytes(`10 d`, \"r\"); // =\u003e 0.17453\n// convert multiple units\n// 10 ft + 100 inch + 1 km + 1 ft = 3300.1732283464567 ft\nconvert.length([10, \"FT\", 100, \"IN\", 1, \"KM\", 1, \"FT\"], \"FT\"); // =\u003e 3300.1732283464567\n// or\nconvert.length(\"10 ft 100 in 1 km\", \"ft\"); // =\u003e 3299.1732283464567\n```\n\n## Notes on convert.degrees\n\n1. you could write `10.2d1.2'1.3''` or `10.2°1.2'1.3''` (the numbers here could be replaced with other numbers) instead of `10.2 d 1.2 arcminute 1.3 arcsecond`\n1. you could use multiple units at once\n1. convert.degrees is the ONLY function allows number and unit names to be directly added together like `10radians`\n\n```js\n// examples\nconvert.degrees(\"10.2d1.2'1.3''\", \"radians\"); // =\u003e 0.178378952\n\nconvert.degrees(\"10.2d1.2'1.3'' 10r\", \"radians\"); // =\u003e 10.178378952\n```\n\n## options\n\n### stringify\n\nif true returns output in string (default: false)\n\nexample:\n\n```js\nimport convert from \"convert-pro\";\n\nconvert.length(\"1 m\", \"cm\", { stringify: true }); // =\u003e \"100 cm\"\nconvert.length(\"1 m\", \"cm\"); // =\u003e 100\n```\n\n### accuracy\n\nthis options is the accuracy of the size or\nhow many **digits** are there after the dot\n\nexample:\n\n```js\nimport convert from \"convert-pro\";\n\nconvert.bytes(\"1024 byte\", { accuracy: 0, stringify: true }); // =\u003e \"1 KB\"\n```\n\n### shortcut\n\nthis option tels the function to use the **shortcuts**\nor the **words**\n\nexample:\n\n```js\nimport convert from \"convert-pro\";\n\nconvert.area(\"100 m2\", \"cm2\", { stringify: true, shortcut: false }); // =\u003e \"1000000 Square Centimeters\"\n```\n\n### lowerCase\n\nthis option tels the function to use **lower case** letters\n\n```js\nimport convert from \"convert-pro\";\n\nconvert.mass(\"10 kg\", \"g\", { lowerCase: true }); // =\u003e 1 kb\n```\n\n## License\n\nCopyright (c) 2021 AliBasicCoder\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falibasiccoder%2Fconvert-pro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falibasiccoder%2Fconvert-pro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falibasiccoder%2Fconvert-pro/lists"}