Skip to content

StayDistributed/from-a-number-to-a-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

from-a-number-to-a-string

Travis npm package Coveralls

Demo

https://staydistributed.github.io/from-a-number-to-a-string

$ npm i @staydistributed/fantas
import Fantas from "@staydistributed/fantas";

const fromNumberToEnglish = new Fantas().transform;

const str = fromNumberToEnglish(1); // return "one"

Custom Fixed Decimals

const fromNumberToEnglish = new Fantas({ fixed: 5 }).transform;

Custom translations

const myLocales = {
  NaN: "Not a Number.",
  negative: "negative",
  infinity: "infinity",
  point: "point",
  and: "and",
  0: "zero",
  1: "one",
  2: "two",
  3: "three",
  4: "four",
  5: "five",
  6: "six",
  7: "seven",
  8: "eight",
  9: "nine",
  10: "ten",
  11: "eleven",
  12: "twelve",
  13: "thirteen",
  14: "fourteen",
  15: "fifteen",
  16: "sixteen",
  17: "seventeen",
  18: "eighteen",
  19: "nineteen",
  "2X": "twenty",
  "3X": "thirty",
  "4X": "fourty",
  "5X": "fifty",
  "6X": "sixty",
  "7X": "seventy",
  "8X": "eighty",
  "9X": "ninety",
  C: "hundred",
  K1: "thousand",
  K2: "million",
  K3: "billion",
  K4: "trillion",
  K5: "quadrillion"
};

const fromNumberToEnglish = new Fantas({ locales: myLocales }).transform;

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published