Skip to content

Spendar89/roman-numeral

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simple number to roman numeral converter. Works in both Node and browser environments. Zero external dependencies.

Installation

To install:

npm install --save roman-numeral

Getting Started

To use:

require('roman-numeral').convert(2016); // >> "MMXVI"

Default Conversion Mapping:

{
  "M": 1000 ,
  "CM": 900,
  "D": 500,
  "C": 100,
  "LX": 60,
  "L": 50,
  "XL": 40,
  "X": 10,
  "IX": 9,
  "V": 5,
  "IV": 4,
  "I": 1 
}

Override default by calling romanNumeral.convert with optional mapping argument:

var custom = {
  "Y": 2015,
  "O": 1
};

require("roman-numeral").convert(2016, custom); // >> "YO"

License

MIT

About

Roman Numeral Converter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published