3.0.4 • Published 4 years ago

js-number-to-word-processor v3.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago
// Navigate To https://repl.it/languages/Nodejs#index.js
// On repl.it Call...

const JSnumberToWordProcessor = require("js-number-to-word-processor");

// Pass In A Single Number-String (with or without a decimal number argument)
JSnumberToWordProcessor("-4783484773.7634656549", 9);

// OR An Array Of Numbers
JSnumberToWordProcessor(["6677", "-7674.969", "0.00"]);
<script src="curStrLengthFunc_2.min.js"></script>
<script src="JSnumberToWordProcessor.js"></script>
npm i js-number-to-word-processor
const JSnumberToWordProcessor = require("js-number-to-word-processor");
import JSnumberToWordProcessor from "js-number-to-word-processor";
require(["js-number-to-word-processor"], function (num) {
  // Use JSnumberToWordProcessor here in local scope.
});

Call JSnumberToWordProcessor & PASS In Either A Positive Whole Number, BigInteger, OR Number-String

JSnumberToWordProcessor("987"); // 987: Nine Hundred and Eighty-Seven
JSnumberToWordProcessor(8476787747); // 8,476,787,747: Eight Billion, Four Hundred and Seventy-Six Million, Seven Hundred and Eighty-Seven Thousand, Seven Hundred and Forty-Seven
JSnumberToWordProcessor(5876985876950n); // 5,876,985,876,950: Five Trillion, Eight Hundred and Seventy-Six Billion, Nine Hundred and Eighty-Five Million, Eight Hundred and Seventy-Six Thousand, Nine Hundred and Fifty
JSnumberToWordProcessor(BigInt(6856767875879601367476468) % BigInt(8)); // 0: Zero
JSnumberToWordProcessor([
  "6478", // 6,478: Six Thousand, Four Hundred and Seventy-Eight
  579n, // 579: Five Hundred and Seventy-Nine
  "57682587695780", // 57,682,587,695,780: Fifty-Seven Trillion, Six Hundred and Eighty-Two Billion, Five Hundred and Eighty-Seven Million, Six Hundred and Ninety-Five Thousand, Seven Hundred and Eighty
]);
JSnumberToWordProcessor([
  6478 * (55.999865 * -8), // -2,902,137.38: (negative) Two Million, Nine Hundred and Two Thousand, One Hundred and Thirty-Seven (dot) Thirty-Eight hundredths
  579n / ((55n / 11n) * 10n), // 11: Eleven
  579 / ((55 / 11) * 10), // 11.58: Eleven (dot) Fifty-Eight
]);
JSnumberToWordProcessor(5876.98587695); // 5,876.99: Five Thousand, Eight Hundred and Seventy-Six (dot) Ninety-Nine hundredths
JSnumberToWordProcessor("5876.985876950", 5); // 5,876.98,588: Five Thousand, Eight Hundred and Seventy-Six (dot) Ninety-Eight Thousand, Five Hundred and Eighty-Eight hundred-thousandths
JSnumberToWordProcessor("-876950"); // -876,950: (negative) Eight Hundred and Seventy-Six Thousand, Nine Hundred and Fifty
JSnumberToWordProcessor("-8769.5", 1); // -8,769.50: (negative) Eight Thousand, Seven Hundred and Sixty-Nine (dot) Five tenths
JSnumberToWordProcessor(55 / 11); // 5: Five
JSnumberToWordProcessor(55 * 11); // 605: Six Hundred and Five
JSnumberToWordProcessor(555n * 111n); // 61,605: Sixty-One Thousand, Six Hundred and Five
JSnumberToWordProcessor(55 - 11); // 44: Forty-Four
JSnumberToWordProcessor(55 + 11); // 66: Sixty-Six
JSnumberToWordProcessor("55" ** "3"); // 166,375: One Hundred and Sixty-Six Thousand, Three Hundred and Seventy-Five
JSnumberToWordProcessor(55 % 3); // 1: One
JSnumberToWordProcessor(55 + -8); // 47: Forty-Seven
JSnumberToWordProcessor(55.1 / 3 - 8.2); // 10.17: Ten (dot) Seventeen hundredths
JSnumberToWordProcessor(55 * 0.8); // 44: Forty-Four
JSnumberToWordProcessor(5876 / 985876950); // 0.60: Zero (dot) Sixty
JSnumberToWordProcessor(55n ** 18n); // 21,209,401,372,879,911,350,250,244,140,625: Twenty-One Nonillion, Two Hundred and Nine Octillion, Four Hundred and One Septillion, Three Hundred and Seventy-Two Sextillion, Eight Hundred and Seventy-Nine Quintillion, Nine Hundred and Eleven Quadrillion, Three Hundred and Fifty Trillion, Two Hundred and Fifty Billion, Two Hundred and Forty-Four Million, One Hundred and Forty Thousand, Six Hundred and Twenty-Five
JSnumberToWordProcessor([(BigInt(55) / BigInt(11)) * BigInt(10)]); // 50: Fifty
JSnumberToWordProcessor(55.999865 * -8.5, 6); // -475.99,885: (negative) Four Hundred and Seventy-Five (dot) Nine Hundred and Ninety-Eight Thousand, Eight Hundred and Fifty-Three millionths
JSnumberToWordProcessor(
  [
    "55.999858659554367" * "-8.79", // -475.99,885: (negative) Four Hundred and Ninety-Two (dot) Twenty-Three Trillion, Eight Hundred and Seventy-Five Billion, Seven Hundred and Sixty-One Million, Seven Hundred and Forty-Eight Thousand, Two Hundred and Eighty-Six hundred-trillionths
    55.999999 + 8, // 64.00: Sixty-Four
  ],
  14
);
JSnumberToWordProcessor(55.888888 + 8, 5); // 63.88,889: Sixty-Three (dot) Eighty-Eight Thousand, Eight Hundred and Eighty-Nine hundred-thousandths
JSnumberToWordProcessor(55.999999 / 8, 5); // 7.00: Seven
JSnumberToWordProcessor(55.1 - 8.2, 3); // 46.900: Forty-Six (dot) Nine Hundred thousandths
JSnumberToWordProcessor(55.9979865 * -(-8.5), 7); // 475.9,828,853: Four Hundred and Seventy-Five (dot) Nine Million, Eight Hundred and Twenty-Eight Thousand, Eight Hundred and Fifty-Three ten-millionths
JSnumberToWordProcessor(
  [
    -55.999865 * -8.5, // 475.9,988,525: Four Hundred and Seventy-Five (dot) Nine Million, Nine Hundred and Eighty-Eight Thousand, Five Hundred and Twenty-Five ten-millionths
    5 ** 4, // 625: Six Hundred and Twenty-Five
  ],
  7
);
JSnumberToWordProcessor(55 > 26); // 1: One
JSnumberToWordProcessor(55 < 26); // 0: Zero
JSnumberToWordProcessor(55 <= 26); // 0: Zero
JSnumberToWordProcessor(55 == "55"); // 1:
JSnumberToWordProcessor(55 === "55"); // 0: Zero
JSnumberToWordProcessor(55 !== "55"); // 1: One

JavaScript Number To Word Processor Is Developed By Saheed Odulaja. Feel Free To Fork This Repository. Also Be Kind Enough To Leave A STAR 🌟 As A Mark Of Encouragement 😃.