aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Burwell <ben.burwell@trifecta.com>2016-07-29 11:35:17 -0400
committerBen Burwell <ben.burwell@trifecta.com>2016-07-29 11:35:17 -0400
commitc7ef1919d9898c829c5fb36e2eb612bdf0bde69f (patch)
tree882b794f6e2164fa9ffb940a74d4252ca6454517 /lib
Initial commit
Diffstat (limited to 'lib')
-rw-r--r--lib/digits.js31
-rw-r--r--lib/multipliers.js26
-rw-r--r--lib/utils.js20
3 files changed, 77 insertions, 0 deletions
diff --git a/lib/digits.js b/lib/digits.js
new file mode 100644
index 0000000..7268b62
--- /dev/null
+++ b/lib/digits.js
@@ -0,0 +1,31 @@
+var digitToAlpha = {
+ 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',
+ 20: 'twenty',
+ 30: 'thirty',
+ 40: 'forty',
+ 50: 'fifty',
+ 60: 'sixty',
+ 70: 'seventy',
+ 80: 'eighty',
+ 90: 'ninety',
+};
+
+module.exports = digitToAlpha;
diff --git a/lib/multipliers.js b/lib/multipliers.js
new file mode 100644
index 0000000..77194e1
--- /dev/null
+++ b/lib/multipliers.js
@@ -0,0 +1,26 @@
+var multiplierToAlpha = {
+ 1: 'thousand',
+ 2: 'million',
+ 3: 'billion',
+ 4: 'trillion',
+ 5: 'quadrillion',
+ 6: 'quintillion',
+ 7: 'sextillion',
+ 8: 'septillion',
+ 9: 'octillion',
+ 10: 'nonillion',
+ 11: 'decillion',
+ 12: 'undecillion',
+ 13: 'duodecillion',
+ 14: 'tredecillion',
+ 15: 'quattuordecillion',
+ 16: 'quindecillion',
+ 17: 'sexdecillion',
+ 18: 'septendecillion',
+ 19: 'octodecillion',
+ 20: 'novemdecillion',
+ 21: 'vigintillion',
+ 22: 'centillion',
+};
+
+module.exports = multiplierToAlpha;
diff --git a/lib/utils.js b/lib/utils.js
new file mode 100644
index 0000000..2c3ce8b
--- /dev/null
+++ b/lib/utils.js
@@ -0,0 +1,20 @@
+function atoi(str) {
+ return parseInt(str, 10);
+};
+
+function chunkify(str) {
+ var parts = [];
+ var offset = 0;
+ var length = str.length % 3 || 3;
+ while (offset < str.length) {
+ parts.push(str.substring(offset, offset + length));
+ offset += length;
+ length = 3;
+ }
+ return parts;
+}
+
+module.exports = {
+ atoi: atoi,
+ chunkify: chunkify,
+};