mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-25 11:14:05 +00:00
And rewrite all the require calls. ```bash git mv src/utils/* packages/@uppy/utils/src sed -i 's/[./]*\/utils\//@uppy\/utils\/lib\//' src/**/*.js # transform (../)*utils → @uppy/utils ```
18 lines
523 B
JavaScript
18 lines
523 B
JavaScript
/**
|
|
* Takes a file object and turns it into fileID, by converting file.name to lowercase,
|
|
* removing extra characters and adding type, size and lastModified
|
|
*
|
|
* @param {Object} file
|
|
* @return {String} the fileID
|
|
*
|
|
*/
|
|
module.exports = function generateFileID (file) {
|
|
// filter is needed to not join empty values with `-`
|
|
return [
|
|
'uppy',
|
|
file.name ? file.name.toLowerCase().replace(/[^A-Z0-9]/ig, '') : '',
|
|
file.type,
|
|
file.data.size,
|
|
file.data.lastModified
|
|
].filter(val => val).join('-')
|
|
}
|