-
Notifications
You must be signed in to change notification settings - Fork 44
/
mdict-common.js
39 lines (35 loc) · 936 Bytes
/
mdict-common.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
!(function (root, factory) {
"use strict";
if (typeof define === 'function') {
if (define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else {
// TODO: For Node
/*
define(function(require, exports, module)) {
exports = factory();
});
*/
}
}
}(this, function() {
return {
/**
* Get file extension.
*/
getExtension: function (filename, defaultExt) {
return /(?:\.([^.]+))?$/.exec(filename)[1] || defaultExt;
},
/**
* Regular expression to strip key if dictionary's "StripKey" attribute is true.
*/
REGEXP_STRIPKEY: {
'mdx' : /[()., '/\\@_-]()/g,
'mdd' : /([.][^.]*$)|[()., '/\\@_-]/g // strip '.' before file extension that is keeping the last period
},
log: function() {
console.log.apply(console, [].slice.apply(arguments));
}
};
}));