From b8283b373caa2ac198497a8dd466bf494d81982a Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Wed, 20 Nov 2024 13:04:14 +0000 Subject: Prettified Code! --- webAO/utils/getAnimLength.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'webAO/utils/getAnimLength.js') diff --git a/webAO/utils/getAnimLength.js b/webAO/utils/getAnimLength.js index 2d83844..ac673c2 100644 --- a/webAO/utils/getAnimLength.js +++ b/webAO/utils/getAnimLength.js @@ -2,26 +2,26 @@ /* eslint no-restricted-syntax: "off" */ /* TODO: use promises for this */ -import calculatorHandler from './calculatorHandler'; -import fileExists from './fileExists'; -import { requestBuffer } from '../services/request'; +import calculatorHandler from "./calculatorHandler"; +import fileExists from "./fileExists"; +import { requestBuffer } from "../services/request"; /** - * Gets animation length. If the animation cannot be found, it will - * silently fail and return 0 instead. - * @param {string} filename the animation file name - */ + * Gets animation length. If the animation cannot be found, it will + * silently fail and return 0 instead. + * @param {string} filename the animation file name + */ const getAnimLength = async (url) => { - const extensions = ['.gif', '.webp', '.apng']; - for (const extension of extensions) { - const urlWithExtension = url + extension; - const exists = await fileExists(urlWithExtension); - if (exists) { - const fileBuffer = await requestBuffer(urlWithExtension); - const length = calculatorHandler[extension](fileBuffer); - return length; - } + const extensions = [".gif", ".webp", ".apng"]; + for (const extension of extensions) { + const urlWithExtension = url + extension; + const exists = await fileExists(urlWithExtension); + if (exists) { + const fileBuffer = await requestBuffer(urlWithExtension); + const length = calculatorHandler[extension](fileBuffer); + return length; } - return 0; + } + return 0; }; export default getAnimLength; -- cgit