mdict-common.js 600 B

1234567891011121314151617181920212223
  1. var MCommon = (function () {
  2. return {
  3. /**
  4. * Get file extension.
  5. */
  6. getExtension: function (filename, defaultExt) {
  7. return /(?:\.([^.]+))?$/.exec(filename)[1] || defaultExt;
  8. },
  9. /**
  10. * Regular expression to strip key if dictionary's "StripKey" attribute is true.
  11. */
  12. REGEXP_STRIPKEY: {
  13. 'mdx' : /[()., '/\\@_-]()/g,
  14. 'mdd' : /([.][^.]*$)|[()., '/\\@_-]/g // strip '.' before file extension that is keeping the last period
  15. },
  16. log: function() {
  17. console.log.apply(console, [].slice.apply(arguments));
  18. }
  19. };
  20. }());