JSFiddle - React, Tailwind, and code Playground

by Alex Alex

JavaScript

function createFileHash(fileName, fileSize, fileLastModifiedDate) {
    var encodeFileName,
        hash = '';

    if (fileName) {
        encodeFileName = encodeURIComponent(fileName).replace(/[^0-9a-z]/gi, '');
        hash = parseInt(encodeFileName, 36).toString().replace(/\.|e\+/g, '');
        console.log(hash);
    }

    if (fileSize) {
        hash += fileSize.toString();
    }

    if (fileLastModifiedDate) {
        hash += fileLastModifiedDate.toString();
    }

    return hash;

}
console.log('');
createFileHash('2014-06-09 13.05.45.jpg', 0);
createFileHash('2014-06-09 13.05.21.jpg', 0);