{"id":17049056,"url":"https://github.com/toddself/split-measure-units","last_synced_at":"2025-10-17T02:38:11.338Z","repository":{"id":57166972,"uuid":"45370451","full_name":"toddself/split-measure-units","owner":"toddself","description":"Split up the amount and units designator and optionally convert to a new unit","archived":false,"fork":false,"pushed_at":"2015-11-09T18:07:40.000Z","size":132,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T05:12:06.314Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toddself.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":"2015-11-02T03:35:36.000Z","updated_at":"2019-05-30T06:09:18.000Z","dependencies_parsed_at":"2022-08-30T15:21:53.603Z","dependency_job_id":null,"html_url":"https://github.com/toddself/split-measure-units","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toddself%2Fsplit-measure-units","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toddself%2Fsplit-measure-units/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toddself%2Fsplit-measure-units/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toddself%2Fsplit-measure-units/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toddself","download_url":"https://codeload.github.com/toddself/split-measure-units/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245054033,"owners_count":20553436,"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-10-14T09:53:45.271Z","updated_at":"2025-10-17T02:38:06.317Z","avatar_url":"https://github.com/toddself.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/toddself/split-measure-units.svg?branch=master)](https://travis-ci.org/toddself/split-measure-units)\n\n# split-measure-units\n\nA small function that will separate out the amount from the units in a normal English measurement phrase, and optionally convert it to a different unit\n\n## ES6 Module!\nThis is authored as an ES6 module and relies on ES6 features. The `main` key in `package.json` points to the transpiled ES5 source, but the `jsnext:main` key points to the ES6 original source. If your environement supports: \n\n* block scoping (`let` \u0026 `const`)\n* destructuring (`let [abbott, costello] = ['abbot', 'costello']`)\n* ES6 `import` and `export`\n\nThen feel free to use the ES6 source directly.\n\n## Usage\n```js\nimport splitMeasure from 'split-measure-units'\n\nconsole.log(splitMeasure('1 cup')) // [1, 'cup', 'cup']\nconsole.log(splitMeasure('12 minutes')) // [12, 'minutes', 'minutes']\nconsole.log(splitMeasure('62.45 hampsters')) // [62.45, 'hampsters', 'hampsters']\nconsole.log(splitMeasure('1 gal', 'qt')) // [4, 'qt', 'gal']\n```\n\nThe method takes two arguments: the measurement and an optional unit to convert to.  For conversions is relies on [convert-units](https://github.com/ben-ng/convert-units/), so see that documentation for what units it can convert. It will also support converting between Farhenheit and Celsius independant of the convert-units library\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoddself%2Fsplit-measure-units","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoddself%2Fsplit-measure-units","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoddself%2Fsplit-measure-units/lists"}