uweb/en/searchurl/mdict/mdict-common.js

23 lines
600 B
JavaScript
Raw Normal View History

2022-10-12 09:43:25 +00:00
var MCommon = (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));
}
};
}());