From 4a9bddd767015657190be625191301b534b97c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Mur=C3=A7a?= Date: Tue, 22 Nov 2022 15:03:31 -0300 Subject: [PATCH] Rename function and variable --- src/lib/FileViewer.svelte | 12 ++++++------ .../{filterFileRequirements.js => filterFiles.js} | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) rename src/utils/{filterFileRequirements.js => filterFiles.js} (89%) diff --git a/src/lib/FileViewer.svelte b/src/lib/FileViewer.svelte index c8a093a..d158974 100644 --- a/src/lib/FileViewer.svelte +++ b/src/lib/FileViewer.svelte @@ -3,18 +3,18 @@ import Dropzone from "./Dropzone.svelte"; import FileList from "./FileList.svelte"; - import { filterFileRequirements } from "../utils/filterFileRequirements"; + import { filterFiles } from "../utils/filterFiles"; let acceptedFiles; let rejectedFiles; - let isAcceptedFilesRendered = false; + let areAcceptedFilesRendered = false; const fileRequirements = { supportedFormats: [".pes"], maxSize: 700000, }; const onSubmit = () => { - isAcceptedFilesRendered = true; + areAcceptedFilesRendered = true; }; const onDrop = (evt) => { @@ -23,13 +23,13 @@ const onChange = (evt) => { acceptedFiles = null; - isAcceptedFilesRendered = false; + areAcceptedFilesRendered = false; const changedFiles = evt.dataTransfer ? evt.dataTransfer.files : evt.target.files; - const results = filterFileRequirements(changedFiles, fileRequirements); + const results = filterFiles(changedFiles, fileRequirements); acceptedFiles = results.accepted; rejectedFiles = results.rejected; }; @@ -69,7 +69,7 @@ -{#if isAcceptedFilesRendered} +{#if areAcceptedFilesRendered} {:else} diff --git a/src/utils/filterFileRequirements.js b/src/utils/filterFiles.js similarity index 89% rename from src/utils/filterFileRequirements.js rename to src/utils/filterFiles.js index 2d5ddae..62f8f36 100644 --- a/src/utils/filterFileRequirements.js +++ b/src/utils/filterFiles.js @@ -5,7 +5,7 @@ const areRequirementsFulfilled = (requirements, file) => requirements.maxSize >= file.size && requirements.supportedFormats.includes(formattedFilenameExt(file.name)); -export function filterFileRequirements(files, requirements) { +export function filterFiles(files, requirements) { let accepted = []; let rejected = []; Array.from(files).forEach((file) => {