npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

roman-standard-form

v1.0.1

Published

Helper functions for working with roman numerals.

Downloads

6

Readme

roman-standard-form Language Typescript Code Coverage

Helper functions for working with roman numerals.

Roman numerals

Roman numerals are essentially a decimal number system, but instead of place value notation (in which place-keeping zeros enable a digit to represent different powers of ten) the system uses a set of symbols with fixed values, including "built in" powers of ten. Tally-like combinations of these fixed symbols correspond to the (placed) digits of Arabic numerals. This structure allows for significant flexibility in notation, and many variant forms are attested.

There has never been an official or universally accepted standard for Roman numerals. Usage in ancient Rome varied greatly and became thoroughly chaotic in medieval times. Even the post-renaissance restoration of a largely "classical" notation has failed to produce total consistency: variant forms are even defended by some modern writers as offering improved "flexibility". On the other hand, especially where a Roman numeral is considered a legally binding expression of a number, as in U.S. Copyright law (where an "incorrect" or ambiguous numeral may invalidate a copyright claim, or affect the termination date of the copyright period) it is desirable to strictly follow the usual style described below.

Standard form

The following table displays how Roman numerals are usually written.

| | Thousands | Hundreds | Tens | Units | | --- | --------- | -------- | ---- | ----- | | 1 | M | C | X | I | | 2 | MM | CC | XX | II | | 3 | MMM | CCC | XXX | III | | 4 | | CD | XL | IV | | 5 | | D | L | V | | 6 | | DC | LX | VI | | 7 | | DCC | LXX | VII | | 8 | | DCCC | LXXX | VIII | | 9 | | CM | XC | IX |

The numerals for 4 (IV) and 9 (IX) are written using "subtractive notation", where the first symbol (I) is subtracted from the larger one (V, or X), thus avoiding the clumsier (IIII, and VIIII). Subtractive notation is also used for 40 (XL), 90 (XC), 400 (CD) and 900 (CM).These are the only subtractive forms in standard use.

Usage/Examples

romanNumeral.fromDecimal()

import romanNumeral from 'roman-standard-form';
...
const year = 2022;
const result = romanNumeral.fromDecimal(year);
console.log(result); // will print 'MMXXII'
...

romanNumeral.toDecimal()

import romanNumeral from 'roman-standard-form';
...
const roman = "MMXXII";
const result = romanNumeral.toDecimal(roman);
console.log(result); // will print 2022
...

Authors