{"id":24118315,"url":"https://github.com/fantasyui-com/calculate-percent","last_synced_at":"2025-07-04T22:36:13.774Z","repository":{"id":57192813,"uuid":"137242557","full_name":"fantasyui-com/calculate-percent","owner":"fantasyui-com","description":"Tiny easy to find percentage calculator that returns a fraction of 1, with customizable precision. [Algorithm, Math]","archived":false,"fork":false,"pushed_at":"2021-07-14T02:54:05.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-10T20:18:20.416Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fantasyui-com.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":"2018-06-13T16:32:11.000Z","updated_at":"2021-07-14T02:54:07.000Z","dependencies_parsed_at":"2022-09-01T05:54:10.894Z","dependency_job_id":null,"html_url":"https://github.com/fantasyui-com/calculate-percent","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fantasyui-com%2Fcalculate-percent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fantasyui-com%2Fcalculate-percent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fantasyui-com%2Fcalculate-percent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fantasyui-com%2Fcalculate-percent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fantasyui-com","download_url":"https://codeload.github.com/fantasyui-com/calculate-percent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241176614,"owners_count":19922732,"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":"2025-01-11T08:19:08.413Z","updated_at":"2025-02-28T15:43:27.410Z","avatar_url":"https://github.com/fantasyui-com.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# calculate-percent\nTiny easy to find percentage calculator that returns a simple integer [Algorithm, Math]\n\n```JavaScript\nconst calculatePercentSimple = require('calculate-percent/simple.js');\n\nconst val = 50;\nconst max = 100;\n\nconsole.log( calculatePercentSimple(val, max) ); // -\u003e 50\n\n```\n\nPlease note that min is optional and zero by default\n\n```JavaScript\nconst calculatePercent = require('calculate-percent');\n\nconst val = 0;\nconst min = -100;\nconst max = 100;\n\nconsole.log( calculatePercent(val, max, min) ); // -\u003e 50\n\n```\n\n## Breaking API Changes in 2.x\n\nI felt that returning a fraction, and asking for precision was making things too difficult.\nI think it is best to simply pct(250, 1000) and be done with it. In the rare case that one is not working with zero we add the min: pct(250,1000,-1000).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffantasyui-com%2Fcalculate-percent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffantasyui-com%2Fcalculate-percent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffantasyui-com%2Fcalculate-percent/lists"}