at the end of the day, it was inevitable

This commit is contained in:
Mo Elzubeir
2022-12-09 08:36:26 -06:00
commit 1218570914
1768 changed files with 887087 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
export const padLeft = function (string, total) {
if (typeof string !== 'string') {
throw new Error('First parameter must be a string')
}
if (typeof total !== 'number') {
throw new Error('Second parameter must be a integer')
}
return new Array(total - string.length + 1).join('0') + string
}
export const addOrdinalSuffix = function (num) {
if (typeof num !== 'number') {
return num
}
const j = num % 10
const k = num % 100
if (j === 1 && k !== 11) {
return num + 'st'
}
if (j === 2 && k !== 12) {
return num + 'nd'
}
if (j === 3 && k !== 13) {
return num + 'rd'
}
return num + 'th'
}