function _checkFileExtension(filename, extension) {
            if (!extension || extension === true || extension === 'true') {
              extension = '';
            }
            if (!filename) {
              filename = 'untitled';
            }
            var ext = '';
            // make sure the file will have a name, see if filename needs extension
            if (filename && filename.includes('.')) {
              ext = filename.split('.').pop();
            }
            // append extension if it doesn't exist
            if (extension) {
              if (ext !== extension) {
                ext = extension;
                filename = ''.concat(filename, '.').concat(ext);
              }
            }
            return [filename, ext];
          }
Helper function, a callback for download that deletes
 an invisible anchor element from the DOM once the file
 has been automatically downloaded.

 @private