-
Notifications
You must be signed in to change notification settings - Fork 4
/
format.js
51 lines (48 loc) · 1.02 KB
/
format.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
define([
"./stt/breadcrumb",
"./stt/comma",
"./stt/custom",
"./stt/email",
"./stt/filepath",
"./stt/formula",
"./stt/sql",
"./stt/underscore",
"./stt/url",
"./stt/word",
"./stt/xpath"
], function (breadcrumb, comma, custom, email, filepath, formula, sql, underscore, url, word, xpath) {
function getHandler(type) { //jshint maxcomplexity: 15
switch (type) {
case "breadcrumb" :
return breadcrumb;
case "comma" :
return comma;
case "email" :
return email;
case "filepath" :
return filepath;
case "formula" :
return formula;
case "sql" :
return sql;
case "underscore" :
return underscore;
case "url" :
return url;
case "word" :
return word;
case "xpath" :
return xpath;
default:
return custom;
}
}
return {
getString: function (text, type, args, isRtl, locale) {
return getHandler(type).format(text, args, isRtl, false, locale);
},
getHtml: function (text, type, args, isRtl, locale) {
return getHandler(type).format(text, args, isRtl, true, locale);
}
};
});