{"id":17260800,"url":"https://github.com/jakeboone02/numeric-quantity","last_synced_at":"2025-04-19T12:33:21.808Z","repository":{"id":28941917,"uuid":"32467808","full_name":"jakeboone02/numeric-quantity","owner":"jakeboone02","description":"Convert integer plus fraction into a decimal value","archived":false,"fork":false,"pushed_at":"2025-04-01T00:34:48.000Z","size":3644,"stargazers_count":22,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-08T22:08:13.541Z","etag":null,"topics":["converts","fraction","javascript","quantity"],"latest_commit_sha":null,"homepage":"https://jakeboone02.github.io/numeric-quantity/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"barryclark/jekyll-now","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jakeboone02.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["jakeboone02"]}},"created_at":"2015-03-18T15:40:38.000Z","updated_at":"2024-07-06T18:25:55.000Z","dependencies_parsed_at":"2024-03-21T18:41:46.024Z","dependency_job_id":"ff396a97-f013-4702-b91a-e22876209dcc","html_url":"https://github.com/jakeboone02/numeric-quantity","commit_stats":{"total_commits":100,"total_committers":1,"mean_commits":100.0,"dds":0.0,"last_synced_commit":"5cd76e6edb26df1e3650e366d95680eef241a50c"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakeboone02%2Fnumeric-quantity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakeboone02%2Fnumeric-quantity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakeboone02%2Fnumeric-quantity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakeboone02%2Fnumeric-quantity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakeboone02","download_url":"https://codeload.github.com/jakeboone02/numeric-quantity/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249693199,"owners_count":21311464,"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":["converts","fraction","javascript","quantity"],"created_at":"2024-10-15T07:49:16.427Z","updated_at":"2025-04-19T12:33:21.765Z","avatar_url":"https://github.com/jakeboone02.png","language":"TypeScript","funding_links":["https://github.com/sponsors/jakeboone02"],"categories":[],"sub_categories":[],"readme":"[![npm][badge-npm]](https://www.npmjs.com/package/numeric-quantity)\n![workflow status](https://github.com/jakeboone02/numeric-quantity/actions/workflows/main.yml/badge.svg)\n[![codecov.io](https://codecov.io/github/jakeboone02/numeric-quantity/coverage.svg?branch=main)](https://codecov.io/github/jakeboone02/numeric-quantity?branch=main)\n[![downloads](https://img.shields.io/npm/dm/numeric-quantity.svg)](http://npm-stat.com/charts.html?package=numeric-quantity\u0026from=2015-08-01)\n[![MIT License](https://img.shields.io/npm/l/numeric-quantity.svg)](http://opensource.org/licenses/MIT)\n\nConverts a string to a number, like an enhanced version of `parseFloat`.\n\n**[Full documentation](https://jakeboone02.github.io/numeric-quantity/)**\n\nFeatures:\n\n- In addition to plain integers and decimals, `numeric-quantity` can parse numbers with comma or underscore separators (`'1,000'` or `'1_000'`), mixed numbers (`'1 2/3'`), vulgar fractions (`'1⅖'`), and the fraction slash character (`'1 2⁄3'`).\n- To allow and ignore trailing invalid characters _à la_ `parseFloat`, pass `{ allowTrailingInvalid: true }` as the second argument.\n- To parse Roman numerals like `'MCCXIV'` or `'Ⅻ'`, pass `{ romanNumerals: true }` as the second argument or call `parseRomanNumerals` directly.\n- Results will be rounded to three decimal places by default. To avoid rounding, pass `{ round: false }` as the second argument. To round to a different number of decimal places, assign that number to the `round` option (`{ round: 5 }` will round to five decimal places).\n- Returns `NaN` if the provided string does not resemble a number.\n\n\u003e _For the inverse operation—converting a number to an imperial measurement—check out [format-quantity](https://www.npmjs.com/package/format-quantity)._\n\u003e\n\u003e _For a more complete solution to parsing recipe ingredients, try [parse-ingredient](https://www.npmjs.com/package/parse-ingredient)._\n\n## Usage\n\n### Installed\n\n```js\nimport { numericQuantity } from 'numeric-quantity';\n\nconsole.log(numericQuantity('1 1/2')); // 1.5\nconsole.log(numericQuantity('2 2/3')); // 2.667\n```\n\n### CDN\n\nAs an ES module:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import { numericQuantity } from 'https://cdn.jsdelivr.net/npm/numeric-quantity/+esm';\n\n  console.log(numericQuantity('10½')); // 10.5\n\u003c/script\u003e\n```\n\nAs UMD (all exports are properties of the global object `NumericQuantity`):\n\n```html\n\u003cscript src=\"https://unpkg.com/numeric-quantity\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  console.log(NumericQuantity.numericQuantity('xii', { romanNumerals: true })); // 12\n\u003c/script\u003e\n```\n\n[badge-npm]: https://img.shields.io/npm/v/numeric-quantity.svg?cacheSeconds=3600\u0026logo=npm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakeboone02%2Fnumeric-quantity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakeboone02%2Fnumeric-quantity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakeboone02%2Fnumeric-quantity/lists"}