Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
The 'ordinal' npm package is used to convert numbers into their ordinal form (e.g., 1 to 1st, 2 to 2nd, etc.). This is particularly useful for formatting dates, rankings, and other numerical data where ordinal indicators are needed.
Convert number to ordinal
This feature allows you to convert a given number into its corresponding ordinal form. For example, 1 becomes '1st', 2 becomes '2nd', and so on.
const ordinal = require('ordinal');
console.log(ordinal(1)); // '1st'
console.log(ordinal(2)); // '2nd'
console.log(ordinal(3)); // '3rd'
console.log(ordinal(4)); // '4th'
The 'number-to-words' package provides functionality to convert numbers to words, including ordinal words. It offers a broader range of features compared to 'ordinal', such as converting numbers to cardinal words (e.g., 123 to 'one hundred twenty-three').
The 'ordinal-js' package is another library for converting numbers to their ordinal forms. It is similar to 'ordinal' but may have different performance characteristics or additional features.
Module to provide the English ordinal letters following a numeral.
If other languages are required, please submit an issue.
npm install --save ordinal
yarn add ordinal
Numbers only, anything else will throw a TypeError
.
var ordinal = require('ordinal')
ordinal(1) // '1st'
ordinal(2) // '2nd'
ordinal(3) // '3rd'
ordinal(4) // '4th'
ordinal(11) // '11th'
ordinal(12) // '12th'
ordinal(13) // '13th'
ordinal(21) // '21st'
ordinal(22) // '22nd'
ordinal(23) // '23rd'
ordinal(24) // '24th'
To get just the indicator:
var indicator = require('ordinal/indicator')
indicator(1) // 'st'
indicator(2) // 'nd'
indicator(3) // 'rd'
indicator(4) // 'th'
indicator(11) // 'th'
indicator(12) // 'th'
indicator(13) // 'th'
indicator(21) // 'st'
indicator(22) // 'nd'
indicator(23) // 'rd'
indicator(24) // 'th'
FAQs
Module to provide the ordinal letters following a numeral
The npm package ordinal receives a total of 114,994 weekly downloads. As such, ordinal popularity was classified as popular.
We found that ordinal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.