{"id":24118477,"url":"https://github.com/fantasyui-com/calculate-progress","last_synced_at":"2025-07-24T10:12:02.847Z","repository":{"id":57192814,"uuid":"211405973","full_name":"fantasyui-com/calculate-progress","owner":"fantasyui-com","description":"Calculate progress for a progress bar.","archived":false,"fork":false,"pushed_at":"2022-07-22T16:16:13.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T21:47:27.394Z","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":"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":"2019-09-27T21:42:04.000Z","updated_at":"2021-10-03T19:16:13.000Z","dependencies_parsed_at":"2022-08-24T03:10:59.278Z","dependency_job_id":null,"html_url":"https://github.com/fantasyui-com/calculate-progress","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-progress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fantasyui-com%2Fcalculate-progress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fantasyui-com%2Fcalculate-progress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fantasyui-com%2Fcalculate-progress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fantasyui-com","download_url":"https://codeload.github.com/fantasyui-com/calculate-progress/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:46.344Z","updated_at":"2025-02-28T15:43:50.618Z","avatar_url":"https://github.com/fantasyui-com.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# calculate-progress\n\nProgress calculator that returns a perfectly formatted percent value. [Algorithm, Math]\n\n```JavaScript\n\nconst calculateProgress = require('calculate-progress');\n\nconst max = 100;\nfor (let i=0; i\u003c=max; i++){\n  console.log( `${i} of ${max} = ${calculateProgress(i,max)}% (in standard mode)` );\n}\n\nfor (let i=0; i\u003c=max; i++){\n  console.log( `${i} of ${max} = ${calculateProgress(i,max,{fixedWidth:true})}% (in fixed width mode)` );\n}\n\nconst myAge = 41;\nconst localMortalityAverage = 77;\nconst tpl = 'Congratulations you have successfully survived %s% of your journey';\nconst result1 = calculateProgress(myAge, localMortalityAverage);\nconsole.log( tpl + ' (default display mode).', result1 );\n\nconst result2 = calculateProgress(myAge, localMortalityAverage, {fixedWidth:true});\nconsole.log( tpl + ' (fixed width mode).', result2 )\n\n\n```\n\n```bash\n\n[user@computer calculate-progress]$ ./test.js\n\n\n0 of 100 = 0% (in standard mode)\n1 of 100 = 1% (in standard mode)\n2 of 100 = 2% (in standard mode)\n3 of 100 = 3% (in standard mode)\n4 of 100 = 4% (in standard mode)\n5 of 100 = 5% (in standard mode)\n6 of 100 = 6% (in standard mode)\n7 of 100 = 7% (in standard mode)\n8 of 100 = 8% (in standard mode)\n9 of 100 = 9% (in standard mode)\n10 of 100 = 10% (in standard mode)\n11 of 100 = 11% (in standard mode)\n12 of 100 = 12% (in standard mode)\n13 of 100 = 13% (in standard mode)\n14 of 100 = 14% (in standard mode)\n15 of 100 = 15% (in standard mode)\n16 of 100 = 16% (in standard mode)\n17 of 100 = 17% (in standard mode)\n18 of 100 = 18% (in standard mode)\n19 of 100 = 19% (in standard mode)\n20 of 100 = 20% (in standard mode)\n21 of 100 = 21% (in standard mode)\n22 of 100 = 22% (in standard mode)\n23 of 100 = 23% (in standard mode)\n24 of 100 = 24% (in standard mode)\n25 of 100 = 25% (in standard mode)\n26 of 100 = 26% (in standard mode)\n27 of 100 = 27% (in standard mode)\n28 of 100 = 28% (in standard mode)\n29 of 100 = 29% (in standard mode)\n30 of 100 = 30% (in standard mode)\n31 of 100 = 31% (in standard mode)\n32 of 100 = 32% (in standard mode)\n33 of 100 = 33% (in standard mode)\n34 of 100 = 34% (in standard mode)\n35 of 100 = 35% (in standard mode)\n36 of 100 = 36% (in standard mode)\n37 of 100 = 37% (in standard mode)\n38 of 100 = 38% (in standard mode)\n39 of 100 = 39% (in standard mode)\n40 of 100 = 40% (in standard mode)\n41 of 100 = 41% (in standard mode)\n42 of 100 = 42% (in standard mode)\n43 of 100 = 43% (in standard mode)\n44 of 100 = 44% (in standard mode)\n45 of 100 = 45% (in standard mode)\n46 of 100 = 46% (in standard mode)\n47 of 100 = 47% (in standard mode)\n48 of 100 = 48% (in standard mode)\n49 of 100 = 49% (in standard mode)\n50 of 100 = 50% (in standard mode)\n51 of 100 = 51% (in standard mode)\n52 of 100 = 52% (in standard mode)\n53 of 100 = 53% (in standard mode)\n54 of 100 = 54% (in standard mode)\n55 of 100 = 55% (in standard mode)\n56 of 100 = 56% (in standard mode)\n57 of 100 = 57% (in standard mode)\n58 of 100 = 58% (in standard mode)\n59 of 100 = 59% (in standard mode)\n60 of 100 = 60% (in standard mode)\n61 of 100 = 61% (in standard mode)\n62 of 100 = 62% (in standard mode)\n63 of 100 = 63% (in standard mode)\n64 of 100 = 64% (in standard mode)\n65 of 100 = 65% (in standard mode)\n66 of 100 = 66% (in standard mode)\n67 of 100 = 67% (in standard mode)\n68 of 100 = 68% (in standard mode)\n69 of 100 = 69% (in standard mode)\n70 of 100 = 70% (in standard mode)\n71 of 100 = 71% (in standard mode)\n72 of 100 = 72% (in standard mode)\n73 of 100 = 73% (in standard mode)\n74 of 100 = 74% (in standard mode)\n75 of 100 = 75% (in standard mode)\n76 of 100 = 76% (in standard mode)\n77 of 100 = 77% (in standard mode)\n78 of 100 = 78% (in standard mode)\n79 of 100 = 79% (in standard mode)\n80 of 100 = 80% (in standard mode)\n81 of 100 = 81% (in standard mode)\n82 of 100 = 82% (in standard mode)\n83 of 100 = 83% (in standard mode)\n84 of 100 = 84% (in standard mode)\n85 of 100 = 85% (in standard mode)\n86 of 100 = 86% (in standard mode)\n87 of 100 = 87% (in standard mode)\n88 of 100 = 88% (in standard mode)\n89 of 100 = 89% (in standard mode)\n90 of 100 = 90% (in standard mode)\n91 of 100 = 91% (in standard mode)\n92 of 100 = 92% (in standard mode)\n93 of 100 = 93% (in standard mode)\n94 of 100 = 94% (in standard mode)\n95 of 100 = 95% (in standard mode)\n96 of 100 = 96% (in standard mode)\n97 of 100 = 97% (in standard mode)\n98 of 100 = 98% (in standard mode)\n99 of 100 = 99% (in standard mode)\n100 of 100 = 100% (in standard mode)\n\n\n\n0 of 100 = 000.00% (in fixed width mode)\n1 of 100 = 001.00% (in fixed width mode)\n2 of 100 = 002.00% (in fixed width mode)\n3 of 100 = 003.00% (in fixed width mode)\n4 of 100 = 004.00% (in fixed width mode)\n5 of 100 = 005.00% (in fixed width mode)\n6 of 100 = 006.00% (in fixed width mode)\n7 of 100 = 007.00% (in fixed width mode)\n8 of 100 = 008.00% (in fixed width mode)\n9 of 100 = 009.00% (in fixed width mode)\n10 of 100 = 010.00% (in fixed width mode)\n11 of 100 = 011.00% (in fixed width mode)\n12 of 100 = 012.00% (in fixed width mode)\n13 of 100 = 013.00% (in fixed width mode)\n14 of 100 = 014.00% (in fixed width mode)\n15 of 100 = 015.00% (in fixed width mode)\n16 of 100 = 016.00% (in fixed width mode)\n17 of 100 = 017.00% (in fixed width mode)\n18 of 100 = 018.00% (in fixed width mode)\n19 of 100 = 019.00% (in fixed width mode)\n20 of 100 = 020.00% (in fixed width mode)\n21 of 100 = 021.00% (in fixed width mode)\n22 of 100 = 022.00% (in fixed width mode)\n23 of 100 = 023.00% (in fixed width mode)\n24 of 100 = 024.00% (in fixed width mode)\n25 of 100 = 025.00% (in fixed width mode)\n26 of 100 = 026.00% (in fixed width mode)\n27 of 100 = 027.00% (in fixed width mode)\n28 of 100 = 028.00% (in fixed width mode)\n29 of 100 = 029.00% (in fixed width mode)\n30 of 100 = 030.00% (in fixed width mode)\n31 of 100 = 031.00% (in fixed width mode)\n32 of 100 = 032.00% (in fixed width mode)\n33 of 100 = 033.00% (in fixed width mode)\n34 of 100 = 034.00% (in fixed width mode)\n35 of 100 = 035.00% (in fixed width mode)\n36 of 100 = 036.00% (in fixed width mode)\n37 of 100 = 037.00% (in fixed width mode)\n38 of 100 = 038.00% (in fixed width mode)\n39 of 100 = 039.00% (in fixed width mode)\n40 of 100 = 040.00% (in fixed width mode)\n41 of 100 = 041.00% (in fixed width mode)\n42 of 100 = 042.00% (in fixed width mode)\n43 of 100 = 043.00% (in fixed width mode)\n44 of 100 = 044.00% (in fixed width mode)\n45 of 100 = 045.00% (in fixed width mode)\n46 of 100 = 046.00% (in fixed width mode)\n47 of 100 = 047.00% (in fixed width mode)\n48 of 100 = 048.00% (in fixed width mode)\n49 of 100 = 049.00% (in fixed width mode)\n50 of 100 = 050.00% (in fixed width mode)\n51 of 100 = 051.00% (in fixed width mode)\n52 of 100 = 052.00% (in fixed width mode)\n53 of 100 = 053.00% (in fixed width mode)\n54 of 100 = 054.00% (in fixed width mode)\n55 of 100 = 055.00% (in fixed width mode)\n56 of 100 = 056.00% (in fixed width mode)\n57 of 100 = 057.00% (in fixed width mode)\n58 of 100 = 058.00% (in fixed width mode)\n59 of 100 = 059.00% (in fixed width mode)\n60 of 100 = 060.00% (in fixed width mode)\n61 of 100 = 061.00% (in fixed width mode)\n62 of 100 = 062.00% (in fixed width mode)\n63 of 100 = 063.00% (in fixed width mode)\n64 of 100 = 064.00% (in fixed width mode)\n65 of 100 = 065.00% (in fixed width mode)\n66 of 100 = 066.00% (in fixed width mode)\n67 of 100 = 067.00% (in fixed width mode)\n68 of 100 = 068.00% (in fixed width mode)\n69 of 100 = 069.00% (in fixed width mode)\n70 of 100 = 070.00% (in fixed width mode)\n71 of 100 = 071.00% (in fixed width mode)\n72 of 100 = 072.00% (in fixed width mode)\n73 of 100 = 073.00% (in fixed width mode)\n74 of 100 = 074.00% (in fixed width mode)\n75 of 100 = 075.00% (in fixed width mode)\n76 of 100 = 076.00% (in fixed width mode)\n77 of 100 = 077.00% (in fixed width mode)\n78 of 100 = 078.00% (in fixed width mode)\n79 of 100 = 079.00% (in fixed width mode)\n80 of 100 = 080.00% (in fixed width mode)\n81 of 100 = 081.00% (in fixed width mode)\n82 of 100 = 082.00% (in fixed width mode)\n83 of 100 = 083.00% (in fixed width mode)\n84 of 100 = 084.00% (in fixed width mode)\n85 of 100 = 085.00% (in fixed width mode)\n86 of 100 = 086.00% (in fixed width mode)\n87 of 100 = 087.00% (in fixed width mode)\n88 of 100 = 088.00% (in fixed width mode)\n89 of 100 = 089.00% (in fixed width mode)\n90 of 100 = 090.00% (in fixed width mode)\n91 of 100 = 091.00% (in fixed width mode)\n92 of 100 = 092.00% (in fixed width mode)\n93 of 100 = 093.00% (in fixed width mode)\n94 of 100 = 094.00% (in fixed width mode)\n95 of 100 = 095.00% (in fixed width mode)\n96 of 100 = 096.00% (in fixed width mode)\n97 of 100 = 097.00% (in fixed width mode)\n98 of 100 = 098.00% (in fixed width mode)\n99 of 100 = 099.00% (in fixed width mode)\n100 of 100 = 100.00% (in fixed width mode)\n\n\nCongratulations you have successfully survived 53.25% of your journey (default display mode).\nCongratulations you have successfully survived 053.25% of your journey (fixed width mode).\n\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffantasyui-com%2Fcalculate-progress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffantasyui-com%2Fcalculate-progress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffantasyui-com%2Fcalculate-progress/lists"}