{"id":16350830,"url":"https://github.com/kevva/calc-percent","last_synced_at":"2025-06-25T06:06:00.175Z","repository":{"id":28655206,"uuid":"32174600","full_name":"kevva/calc-percent","owner":"kevva","description":"Calculate percentage","archived":false,"fork":false,"pushed_at":"2017-05-25T13:25:43.000Z","size":136,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-06T23:02:42.212Z","etag":null,"topics":["calc","nodejs","percent"],"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/kevva.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-03-13T18:49:02.000Z","updated_at":"2024-04-05T19:06:23.000Z","dependencies_parsed_at":"2022-08-24T03:10:57.535Z","dependency_job_id":null,"html_url":"https://github.com/kevva/calc-percent","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/kevva/calc-percent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevva%2Fcalc-percent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevva%2Fcalc-percent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevva%2Fcalc-percent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevva%2Fcalc-percent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevva","download_url":"https://codeload.github.com/kevva/calc-percent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevva%2Fcalc-percent/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261816310,"owners_count":23213863,"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":["calc","nodejs","percent"],"created_at":"2024-10-11T01:06:28.823Z","updated_at":"2025-06-25T06:06:00.140Z","avatar_url":"https://github.com/kevva.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# calc-percent [![Build Status](https://travis-ci.org/kevva/calc-percent.svg?branch=master)](https://travis-ci.org/kevva/calc-percent)\n\n\u003e Calculate percentage\n\n\n## Install\n\n```\n$ npm install --save calc-percent\n```\n\n\n## Usage\n\n```js\nvar calcPercent = require('calc-percent');\n\ncalcPercent(10, 50);\n//=\u003e '20'\n\ncalcPercent(10, 50, {suffix: '%'});\n//=\u003e '20%'\n\ncalcPercent(100 / 3, 100, {decimal: 2});\n//=\u003e '33.33'\n```\n\n\n## API\n\n### calcPercent(val, total, options)\n\n#### val\n\nType: `number`\n\nValue which should be calculated.\n\n#### total\n\nType: `number`\n\nTotal that `val` should be compared against.\n\n#### options.decimal\n\nType: `number`  \nDefault: `0`\n\nNumber of decimals.\n\n#### options.suffix\n\nType: `string`\n\nAppend a suffix.\n\n\n## License\n\nMIT © [Kevin Mårtensson](https://github.com/kevva)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevva%2Fcalc-percent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevva%2Fcalc-percent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevva%2Fcalc-percent/lists"}