code: function getBasePath(base) {
  	return new Promise((resolve, reject) => {
  		if (base && typeof base.getPath === 'function') {
  			const editorFile = base.getPath();
  			if (!editorFile) {
  				return reject(new Error('Unable to get base path: editor contains unsaved file'));
  			}
  
  			base = path.dirname(editorFile);
  		}
  
  		if (!base || typeof base !== 'string') {
  			reject(new Error(`Unable to get base path from ${base}`));
  		} else {
  			resolve(base);
  		}
  	});
  }
docs: Returns base path from file, opened in given editor
  @param  {TextEditor|String} base
  @return {Promise}