-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
997d1e3
commit 987f9ce
Showing
23 changed files
with
73 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
import ABT from "./index.mjs"; | ||
console.log(ABT("1234567890")) | ||
console.log(ABT("1234567,891.35")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
const VERSION = `2.0.1`; | ||
const VERSION = `2.0.2`; | ||
export default VERSION; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const LeadingZerosRegex = /^0+/; | ||
export default LeadingZerosRegex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const ValidMoneyRegex = /\d*(\.\d+)?/; | ||
export default ValidMoneyRegex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const ZeroSatangRegex = /^0*$/; | ||
export default ZeroSatangRegex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const globalNotDigits = /[^\d]/g; | ||
export default globalNotDigits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const globalSpaceRegex = /\s/g; | ||
export default globalSpaceRegex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import SPLITPATTERN from "../const/regex/SPLITPATTERN.mjs"; | ||
import ValidMoneyRegex from "../const/regex/ValidMoneyRegex.mjs"; | ||
|
||
const IsMoneyValidate = (money, rounding) => { | ||
if (rounding === ``) return SPLITPATTERN.test(money); | ||
return /\d*(\.\d+)?/.test(money); | ||
return ValidMoneyRegex.test(money); | ||
}; | ||
export default IsMoneyValidate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import removeLeadingZeros from "../snippet/removeLeadingZeros.mjs"; | ||
import LeadingZerosRegex from "../const/regex/LeadingZerosRegex.mjs"; | ||
import Replace from "./Replace.mjs"; | ||
|
||
const MoneyLaundering = (money) => { | ||
const removeComma = money.replace(/,/g, ""); | ||
const removeCommaAndUnderScore = removeComma.replace(/_/g, ""); | ||
const removeCommaAndUnderScoreAndLeadingZeros = removeLeadingZeros( | ||
removeCommaAndUnderScore | ||
return Replace( | ||
money | ||
, [/,/g] | ||
, [/_/g] | ||
, [LeadingZerosRegex] | ||
); | ||
return removeCommaAndUnderScoreAndLeadingZeros; | ||
}; | ||
export default MoneyLaundering; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const RepEmt = (str, RegOrStr = '') => str.replace(RegOrStr, ""); | ||
export default RepEmt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const Replace = (str, ...replaces) => { | ||
for (let i of replaces) { | ||
str = str.replace(i[0], i[1] ?? '') | ||
} | ||
return str | ||
} | ||
export default Replace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import RepEmt from "./RepEmt.mjs"; | ||
const splitIntFrac = (money) => { | ||
const match = money.match(/(\d*)(\.\d+)?/); | ||
let [moneyFull, moneyInt, moneyFrac] = match; | ||
moneyFrac === undefined | ||
? (moneyFrac = "") | ||
: (moneyFrac = moneyFrac.replace(/^\./, "")); | ||
: (moneyFrac = RepEmt(moneyFrac, /^\./)); | ||
return [moneyFull, moneyInt, moneyFrac]; | ||
}; | ||
export default splitIntFrac; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
const removeLeadingZeros = (string) => string.replace(/^0+/g, ""); | ||
import RepEmt from "../function/RepEmt.mjs"; | ||
import LeadingZerosRegex from "../const/regex/LeadingZerosRegex.mjs"; | ||
const removeLeadingZeros = (string) => RepEmt(string, LeadingZerosRegex); | ||
export default removeLeadingZeros; |