项目作者: matthieubosquet

项目描述 :
Numerals conversion
高级语言: TypeScript
项目地址: git://github.com/matthieubosquet/numerals.git
创建时间: 2020-06-25T23:19:15Z
项目社区:https://github.com/matthieubosquet/numerals

开源协议:MIT License

下载


Node.js CI
codecov

Numerals

Convert numbers to their form in a numeral system.

Currently only implements the roman numerals system converter.

See also: https://en.wikipedia.org/wiki/List_of_numeral_systems

Try the converter!

How-to?

  • Install the package
  1. npm i numerals
  • Use the package as an ECMAScript module
  1. import { convertNumberToNumeralForm, Language, NumeralForm } from 'numerals';
  2. let x = convertNumberToNumeralForm(8, NumeralForm.Roman, Language.English);
  3. // Outputs VIII
  4. console.log(x);
  • Use the package as a CommonJS module
  1. const { convertNumberToNumeralForm, Language, NumeralForm } = require('numerals')
  2. let x = convertNumberToNumeralForm(8, NumeralForm.Roman, Language.English)
  3. // Outputs VIII
  4. console.log(x);
  • Get the web component
  1. wget https://neig.es/numerals/script/numerals-ui.js
  • Use the web component
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Numerals converter</title>
  7. </head>
  8. <body>
  9. <numerals-ui></numerals-ui>
  10. <script src="./script/numerals-ui.js"></script>
  11. </body>
  12. </html>