Skip to content

TagSpaces is an offline, open source, document manager with tagging support

new utils baseName

Borislav Sapundzhiev48f764424993
diff --git a/data/js/utils.js b/data/js/utils.js
index 738ccdb7f..13ffeb9a5 100644
--- a/data/js/utils.js
+++ b/data/js/utils.js
@@ -45,9 +45,15 @@ define(function(require, exports, module) {
return decodeURIComponent(escape(s));
}
+ var baseName = function(dirPath) {
+ var fileName = dirPath.substring(dirPath.lastIndexOf("/") + 1, dirPath.length);
+ return fileName ? fileName : dirPath;
+ };
+
exports.arrayBufferToDataURL = arrayBufferToDataURL;
exports.base64ToArrayBuffer = base64ToArrayBuffer;
exports.dataURLtoBlob = dataURLtoBlob;
exports.getBase64Image = getBase64Image;
exports.arrayBufferToStr = arrayBufferToStr;
+ exports.baseName = baseName;
});