forked from marcinjakubowski/date-menu-formatter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
20 lines (17 loc) · 615 Bytes
/
utils.js
File metadata and controls
20 lines (17 loc) · 615 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var PrefFields = {
PATTERN : 'pattern',
USE_DEFAULT_LOCALE : 'use-default-locale',
CUSTOM_LOCALE : 'custom-locale',
FONT_SIZE : 'font-size',
APPLY_ALL_PANELS : 'apply-all-panels',
REMOVE_MESSAGES_INDICATOR: 'remove-messages-indicator'
};
function getCurrentLocale() {
return (new Intl.DateTimeFormat()).resolvedOptions().locale
}
function convertToPattern(str) {
return '#' + str.replace(new RegExp("\\\\n", "g"), "\n").replace(new RegExp("''", "g"), ">`<")
}
function convertFromPattern(str) {
return str.replace(new RegExp('>`<', "g"), "'")
}