node_modules.inflected.src.ordinal.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apollo-client-maven-plugin Show documentation
Show all versions of apollo-client-maven-plugin Show documentation
Maven plugin for generating graphql clients
export default function ordinal(number) {
const absNumber = Math.abs(Number(number));
const mod100 = absNumber % 100;
if (mod100 === 11 || mod100 === 12 || mod100 === 13) {
return "th";
} else {
switch (absNumber % 10) {
case 1:
return "st";
case 2:
return "nd";
case 3:
return "rd";
default:
return "th";
}
}
}