code: function getFileTypeReg(type) {
    var map = [];
    if (type === 'text') {
      map = TEXT_FILE_EXTS;
    } else if (type === 'image') {
      map = IMAGE_FILE_EXTS;
    } else {
      throw new Error('invalid file type [' + type + ']');
    }
    map = map.join('|');
    return new RegExp('\\.(?:' + map + ')$', 'i');
  }
docs: get the filetype regex expression