refactor: convert function expressions to declarations (#4926)

This commit is contained in:
Vladislav Shkodin
2021-02-08 20:01:21 +02:00
committed by GitHub
parent c0236536dd
commit 141a2eba56
241 changed files with 3444 additions and 2933 deletions

View File

@ -23,7 +23,11 @@ const defaultConfig = {
*/
function isFileGroup(files) {
const basePatternString = `~${files.length}/nth/`;
const mapExpression = (val, idx) => new RegExp(`${basePatternString}${idx}/$`);
function mapExpression(val, idx) {
return new RegExp(`${basePatternString}${idx}/$`);
}
const expressions = Array.from({ length: files.length }, mapExpression);
return expressions.every(exp => files.some(url => exp.test(url)));
}
@ -80,7 +84,7 @@ function openDialog({ files, config, handleInsert, settings = {} }) {
);
}
const buildUrl = fileInfo => {
function buildUrl(fileInfo) {
const { cdnUrl, name, isImage } = fileInfo;
let url =
@ -92,7 +96,7 @@ function openDialog({ files, config, handleInsert, settings = {} }) {
}
return url;
};
}
uploadcare.openDialog(files, config).done(({ promise, files }) => {
const isGroup = Boolean(files);