Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
PingHuskar committed Oct 3, 2024
1 parent fac468a commit d0412c0
Show file tree
Hide file tree
Showing 52 changed files with 326 additions and 239 deletions.
4 changes: 4 additions & 0 deletions const/THB.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = THB = new Intl.NumberFormat("th-TH", {
style: "currency",
currency: "THB",
});
20 changes: 20 additions & 0 deletions const/array/FTHAISATANGWORDS.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const SPECIALTWO = require(`../primitive/SPECIALTWO`)
const THREE = require(`../primitive/THREE`);
const FOUR = require(`../primitive/FOUR`);
const FIVE = require(`../primitive/FIVE`);
const SIX = require(`../primitive/SIX`);
const SEVEN = require(`../primitive/SEVEN`);
const EIGHT = require(`../primitive/EIGHT`);
const NINE = require(`../primitive/NINE`);
module.exports = FTHAISATANGWORDS = [
``,
``,
SPECIALTWO,
THREE,
FOUR,
FIVE,
SIX,
SEVEN,
EIGHT,
NINE,
];
21 changes: 21 additions & 0 deletions const/array/LTHAISATANGWORDS.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const SPECIALONE = require(`../primitive/SPECIALONE`)
const TWO = require(`../primitive/TWO`)
const THREE = require(`../primitive/THREE`)
const FOUR = require(`../primitive/FOUR`)
const FIVE = require(`../primitive/FIVE`)
const SIX = require(`../primitive/SIX`)
const SEVEN = require(`../primitive/SEVEN`)
const EIGHT = require(`../primitive/EIGHT`)
const NINE = require(`../primitive/NINE`)
module.exports = LTHAISATANGWORDS = [
``,
SPECIALONE,
TWO,
THREE,
FOUR,
FIVE,
SIX,
SEVEN,
EIGHT,
NINE,
];
20 changes: 20 additions & 0 deletions const/array/ONETONINE.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const ONE = require(`../primitive/ONE`);
const TWO = require(`../primitive/TWO`);
const THREE = require(`../primitive/THREE`);
const FOUR = require(`../primitive/FOUR`);
const FIVE = require(`../primitive/FIVE`);
const SIX = require(`../primitive/SIX`);
const SEVEN = require(`../primitive/SEVEN`);
const EIGHT = require(`../primitive/EIGHT`);
const NINE = require(`../primitive/NINE`);
module.exports = ONETONINE = [
ONE,
TWO,
THREE,
FOUR,
FIVE,
SIX,
SEVEN,
EIGHT,
NINE,
];
12 changes: 12 additions & 0 deletions const/array/REVERSETHAIDIGITWORDS.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const HUNDRED = require(`../primitive/HUNDRED`);
const THOUSAND = require(`../primitive/THOUSAND`);
const TENTHOUSAND = require(`../primitive/TENTHOUSAND`);
const HUNDREDTHOUSAND = require(`../primitive/HUNDREDTHOUSAND`);
module.exports = REVERSETHAIDIGITWORDS = [
HUNDREDTHOUSAND,
TENTHOUSAND,
THOUSAND,
HUNDRED,
TEN,
"",
];
12 changes: 12 additions & 0 deletions const/array/THAI2ARABICNumerals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = THAI2ARABICNumerals = [
{ th: `๐`, a: `0` },
{ th: `๑`, a: `1` },
{ th: `๒`, a: `2` },
{ th: `๓`, a: `3` },
{ th: `๔`, a: `4` },
{ th: `๕`, a: `5` },
{ th: `๖`, a: `6` },
{ th: `๗`, a: `7` },
{ th: `๘`, a: `8` },
{ th: `๙`, a: `9` },
]
25 changes: 25 additions & 0 deletions const/array/THAINUMBERWORDS.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const ZERO = require(`../primitive/ZERO`);
const ONE = require(`../primitive/ONE`);
const TWO = require(`../primitive/TWO`);
const THREE = require(`../primitive/THREE`);
const FOUR = require(`../primitive/FOUR`);
const FIVE = require(`../primitive/FIVE`);
const SIX = require(`../primitive/SIX`);
const SEVEN = require(`../primitive/SEVEN`);
const EIGHT = require(`../primitive/EIGHT`);
const NINE = require(`../primitive/NINE`);
const TEN = require(`../primitive/TEN`)

module.exports = THAINUMBERWORDS = [
ZERO,
ONE,
TWO,
THREE,
FOUR,
FIVE,
SIX,
SEVEN,
EIGHT,
NINE,
TEN,
];
70 changes: 70 additions & 0 deletions const/array/large_numbers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
module.exports = large_numbers = [
{ name: "Million", powof10: 6 },
{ name: "Billion", powof10: 9 },
{ name: "Trillion", powof10: 12 },
{ name: "Quadrillion", powof10: 15 },
{ name: "Quintillion", powof10: 18 },
{ name: "Sextillion", powof10: 21 },
{ name: "Septillion", powof10: 24 },
{ name: "Octillion", powof10: 27 },
{ name: "Nonillion", powof10: 30 },
{ name: "Decillion", powof10: 33 },
{ name: "Undecillion", powof10: 36 },
{ name: "Duodecillion", powof10: 39 },
{ name: "Tredecillion", powof10: 42 },
{ name: "Quattuordecillion", powof10: 45 },
{ name: "Quindecillion", powof10: 48 },
{ name: "Sedecillion", powof10: 51 },
{ name: "Septendecillion", powof10: 54 },
{ name: "Octodecillion", powof10: 57 },
{ name: "Novendecillion", powof10: 60 },
{ name: "Vigintillion", powof10: 63 },
{ name: "Unvigintillion", powof10: 66 },
{ name: "Duovigintillion", powof10: 69 },
{ name: "Tresvigintillion", powof10: 72 },
{ name: "Quattuorvigintillion", powof10: 75 },
{ name: "Quinvigintillion", powof10: 78 },
{ name: "Sesvigintillion", powof10: 81 },
{ name: "Septemvigintillion", powof10: 84 },
{ name: "Octovigintillion", powof10: 87 },
{ name: "Novemvigintillion", powof10: 90 },
{ name: "Trigintillion", powof10: 93 },
{ name: "Untrigintillion", powof10: 96 },
{ name: "Duotrigintillion", powof10: 99 },
{ name: "Trestrigintillion", powof10: 102 },
{ name: "Quattuortrigintillion", powof10: 105 },
{ name: "Quintrigintillion", powof10: 108 },
{ name: "Sestrigintillion", powof10: 111 },
{ name: "Septentrigintillion", powof10: 114 },
{ name: "Octotrigintillion", powof10: 117 },
{ name: "Noventrigintillion", powof10: 120 },
{ name: "Quadragintillion", powof10: 123 },
{ name: "Quinquagintillion", powof10: 153 },
{ name: "Sexagintillion", powof10: 183 },
{ name: "Septuagintillion", powof10: 213 },
{ name: "Octogintillion", powof10: 243 },
{ name: "Nonagintillion", powof10: 273 },
{ name: "Centillion", powof10: 303 },
{ name: "Uncentillion", powof10: 306 },
{ name: "Decicentillion", powof10: 333 },
{ name: "Undecicentillion", powof10: 336 },
{ name: "Viginticentillion", powof10: 363 },
{ name: "Unviginticentillion", powof10: 366 },
{ name: "Trigintacentillion", powof10: 393 },
{ name: "Quadragintacentillion", powof10: 423 },
{ name: "Quinquagintacentillion", powof10: 453 },
{ name: "Sexagintacentillion", powof10: 483 },
{ name: "Septuagintacentillion", powof10: 513 },
{ name: "Octogintacentillion", powof10: 543 },
{ name: "Nonagintacentillion", powof10: 573 },
{ name: "Ducentillion", powof10: 603 },
{ name: "Trecentillion", powof10: 903 },
{ name: "Quadringentillion", powof10: 1203 },
{ name: "Quingentillion", powof10: 1503 },
{ name: "Sescentillion", powof10: 1803 },
{ name: "Septingentillion", powof10: 2103 },
{ name: "Octingentillion", powof10: 2403 },
{ name: "Nongentillion", powof10: 2703 },
{ name: "Millinillion", powof10: 3003 },
{ name: "Googol", powof10: 100 },
];
96 changes: 96 additions & 0 deletions const/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
const DEBUG = require('./primitive/DEBUG')
const GoogleSheetsCellCharactersLimit = require("./primitive/GoogleSheetsCellCharactersLimit");
const VERSION = require(`./primitive/VERSION`);
const negative = require(`./primitive/negative`);
const SPECIALONE = require("./primitive/SPECIALONE");
const SPECIALTWO = require("./primitive/SPECIALTWO");
const TEN = require("./primitive/TEN");
const BAHT = require("./primitive/BAHT");
const MILLION = require("./primitive/MILLION");
const FULLBAHT = require("./primitive/FULLBAHT");
const SATANG = require("./primitive/SATANG");
const READAS = require("./primitive/READAS");

const LAST6DIGITPATTERN = require(`./regex/LAST6DIGITPATTERN`);
const SPLITPATTERN = require(`./regex/SPLITPATTERN`);

const ZERO = require(`./primitive/ZERO`);
const ONE = require(`./primitive/ONE`);
const TWO = require(`./primitive/TWO`)
const THREE = require(`./primitive/THREE`)
const FOUR = require(`./primitive/FOUR`);
const FIVE = require(`./primitive/FIVE`);
const SIX = require(`./primitive/SIX`);
const SEVEN = require(`./primitive/SEVEN`);
const EIGHT = require(`./primitive/EIGHT`);
const NINE = require(`./primitive/NINE`);
const THAINUMBERWORDS = require(`./array/THAINUMBERWORDS`)
const ONETONINE = require(`./array/ONETONINE`);
const LTHAISATANGWORDS = require(`./array/LTHAISATANGWORDS`);
const FTHAISATANGWORDS = require(`./array/FTHAISATANGWORDS`);
const HUNDRED = require(`./primitive/HUNDRED`);
const THOUSAND = require(`./primitive/THOUSAND`);
const TENTHOUSAND = require(`./primitive/TENTHOUSAND`);
const HUNDREDTHOUSAND = require(`./primitive/HUNDREDTHOUSAND`);
const REVERSETHAIDIGITWORDS = require(`./array/REVERSETHAIDIGITWORDS`);
const THAI2ARABICNumerals = require(`./array/THAI2ARABICNumerals`);
const ValidSATANGRegex = require(`./regex/ValidSATANGRegex`)
const defaultBulkBahtTextPat = require(`./regex/defaultBulkBahtTextPat`);
const defaultBulkBahtTextSkips = require(`./regex/defaultBulkBahtTextSkips`);
const OneToTenTextRegex = require(`./regex/OneToTenTextRegex`);
const ElevenToNineteenRegex = require(`./regex/ElevenToNineteenRegex`);
const TwentyToNinetyNine = require(`./regex/TwentyToNinetyNine`)

const large_numbers = require(`./array/large_numbers`);
const MAX_SAFE_INTEGER = require(`./primitive/MAX_SAFE_INTEGER`);
const octalRegex1 = require(`./regex/octalRegex1`);
const octalRegex2 = require(`./regex/octalRegex2`);
let THB = require(`./THB`);

module.exports = {
DEBUG,
GoogleSheetsCellCharactersLimit,
VERSION,
SPECIALONE,
SPECIALTWO,
TEN,
BAHT,
MILLION,
FULLBAHT,
SATANG,
READAS,
LAST6DIGITPATTERN,
SPLITPATTERN,
ZERO,
ONE,
TWO,
THREE,
FOUR,
FIVE,
SIX,
SEVEN,
EIGHT,
NINE,
THAINUMBERWORDS,
ONETONINE,
LTHAISATANGWORDS,
FTHAISATANGWORDS,
HUNDRED,
THOUSAND,
TENTHOUSAND,
HUNDREDTHOUSAND,
REVERSETHAIDIGITWORDS,
THAI2ARABICNumerals,
ValidSATANGRegex,
defaultBulkBahtTextPat,
defaultBulkBahtTextSkips,
OneToTenTextRegex,
ElevenToNineteenRegex,
TwentyToNinetyNine,
large_numbers,
octalRegex1,
octalRegex2,
MAX_SAFE_INTEGER,
THB,
negative,
};
1 change: 1 addition & 0 deletions const/primitive/BAHT.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = BAHT = `บาท`;
1 change: 1 addition & 0 deletions const/primitive/DEBUG.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = DEBUG = false;
1 change: 1 addition & 0 deletions const/primitive/EIGHT.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = EIGHT = `แปด`;
1 change: 1 addition & 0 deletions const/primitive/FIVE.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = FIVE = `ห้า`;
1 change: 1 addition & 0 deletions const/primitive/FOUR.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = FOUR = `สี่`;
1 change: 1 addition & 0 deletions const/primitive/FULLBAHT.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = FULLBAHT = `ถ้วน`;
1 change: 1 addition & 0 deletions const/primitive/GoogleSheetsCellCharactersLimit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = GoogleSheetsCellCharactersLimit = 50000;
1 change: 1 addition & 0 deletions const/primitive/HUNDRED.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = HUNDRED = `ร้อย`;
1 change: 1 addition & 0 deletions const/primitive/HUNDREDTHOUSAND.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = HUNDREDTHOUSAND = `แสน`;
1 change: 1 addition & 0 deletions const/primitive/MAX_SAFE_INTEGER.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = MAX_SAFE_INTEGER = 9007199254740991;
1 change: 1 addition & 0 deletions const/primitive/MILLION.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = MILLION = `ล้าน`;
1 change: 1 addition & 0 deletions const/primitive/NINE.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = NINE = `เก้า`;
1 change: 1 addition & 0 deletions const/primitive/ONE.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = ONE = `หนึ่ง`;
1 change: 1 addition & 0 deletions const/primitive/READAS.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = READAS = `อ่านว่า`;
1 change: 1 addition & 0 deletions const/primitive/SATANG.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = SATANG = `สตางค์`;
1 change: 1 addition & 0 deletions const/primitive/SEVEN.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = SEVEN = `เจ็ด`;
1 change: 1 addition & 0 deletions const/primitive/SIX.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = SIX = `หก`;
1 change: 1 addition & 0 deletions const/primitive/SPECIALONE.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = SPECIALONE = `เอ็ด`;
1 change: 1 addition & 0 deletions const/primitive/SPECIALTWO.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = SPECIALTWO = `ยี่`;
1 change: 1 addition & 0 deletions const/primitive/TEN.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = TEN = `สิบ`;
1 change: 1 addition & 0 deletions const/primitive/TENTHOUSAND.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = TENTHOUSAND = `หมื่น`;
1 change: 1 addition & 0 deletions const/primitive/THOUSAND.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = THOUSAND = `พัน`;
1 change: 1 addition & 0 deletions const/primitive/THREE.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = THREE = `สาม`;
1 change: 1 addition & 0 deletions const/primitive/TWO.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = TWO = `สอง`;
1 change: 1 addition & 0 deletions const/primitive/VERSION.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = VERSION = `1.4.3`;
1 change: 1 addition & 0 deletions const/primitive/ZERO.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = ZERO = `ศูนย์`;
1 change: 1 addition & 0 deletions const/primitive/negative.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = negative = `ลบ`;
1 change: 1 addition & 0 deletions const/regex/ElevenToNineteenRegex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = ElevenToNineteenRegex = /^สิบ(เอ็ด|สอง|สาม|สี่|ห้า|หก|เจ็ด|แปด|เก้า)$/;
1 change: 1 addition & 0 deletions const/regex/LAST6DIGITPATTERN.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = LAST6DIGITPATTERN = /\d{1,6}$/g;;
2 changes: 2 additions & 0 deletions const/regex/OneToTenTextRegex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module.exports = OneToTenTextRegex =
/^(หนึ่ง|สอง|สาม|สี่|ห้า|หก|เจ็ด|แปด|เก้า|สิบ)$/;
1 change: 1 addition & 0 deletions const/regex/SPLITPATTERN.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = SPLITPATTERN = /^(\d*)(\.\d{0,2}0*)?$/;
2 changes: 2 additions & 0 deletions const/regex/TwentyToNinetyNine.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module.exports = TwentyToNinetyNine =
/^(ยี่|สาม|สี่|ห้า|หก|เจ็ด|แปด|เก้า)สิบ(เอ็ด|สอง|สาม|สี่|ห้า|หก|เจ็ด|แปด|เก้า)?$/;
2 changes: 2 additions & 0 deletions const/regex/ValidSATANGRegex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module.exports = ValidSATANGRegex =
/((ยี่|สาม|สี่|ห้า|หก|เจ็ด|แปด|เก้า)?(สิบ)(เอ็ด|สอง|สาม|สี่|ห้า|หก|เจ็ด|แปด|เก้า)?)สตางค์|(หนึ่ง|สอง|สาม|สี่|ห้า|หก|เจ็ด|แปด|เก้า|สิบ)สตางค์|(ถ้วน)/gs;
1 change: 1 addition & 0 deletions const/regex/defaultBulkBahtTextPat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = defaultBulkBahtTextPat = /\b(\d+)(\.\d{0,2}0*)?\b/g;
1 change: 1 addition & 0 deletions const/regex/defaultBulkBahtTextSkips.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = defaultBulkBahtTextSkips = [/\b5+\+?\b/];
Loading

0 comments on commit d0412c0

Please sign in to comment.