-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
29 lines (27 loc) · 868 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const currencyF = require("./currency-formatter");
const numberF = require("./number-formatter");
const datetimeF = require("./datetime-formatter");
module.exports = {
currencyFormatter: (arg0, arg1, arg2) => {
const price = arg0;
let lang = "";
let currencyString = "";
let options = { lang, currencyString };
if (typeof arg1 === "string") {
lang = arg1;
options.lang = arg1;
} else if (typeof arg1 === "object") {
options = arg1;
}
if (typeof arg2 === "string") {
lang = arg2;
options.currencyString = arg2;
} else if (typeof arg2 === "object") {
options = arg2;
}
return currencyF(price, options, "type");
},
numberFormatter: (number, lang, options) =>
numberF(number, lang, "type", options),
datetimeFormatter: (date, lang, options) => datetimeF(date, lang, options)
};