Last active
January 19, 2023 11:16
-
-
Save gko/c293c92e8a7c62da4270741147df0355 to your computer and use it in GitHub Desktop.
https://twitter.com/JeroenFrijters/status/1615204074588180481 alternative solution for https://github.com/MinBZK/woo-besluit-broncode-digid-app/blob/ad2737c4a039d5ca76633b81e9d4f3f9370549e4/Source/DigiD.iOS/Services/NFCService.cs#L182-L206 this function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getPercentageRounds = function(percentage = 1) { | |
const blueSpotSymbol = "🔵"; | |
const emptySpotSymbol = "⚪"; | |
// 1 to 10 | |
const convertedPercent = Math.ceil(percentage * 10); | |
const blueSpots = Array(convertedPercent).fill(blueSpotSymbol); | |
const emptySpots = Array(10 - convertedPercent).fill(emptySpotSymbol); | |
return [...blueSpots, ...emptySpots].join(''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment