From ddecabba54eb24ab4ac07a67621f805d3ad9e2ce Mon Sep 17 00:00:00 2001 From: Kevin J Hoerr Date: Sun, 26 Apr 2020 21:53:26 -0400 Subject: These changes moved a lot of the startup async to run in a streamlined async init function. This brings more logic "to light", so it should probably have unit tests added to check the edge cases. As a bonus, no async runs as a result of route initialization. Speaking of routes, it might be nice to trim down the route calls themselves with async functions, if possible. The upload routes in particular use a lot of async. Just a note for the future. --- src/formats.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/formats.ts') diff --git a/src/formats.ts b/src/formats.ts index d22ea3e..7638399 100644 --- a/src/formats.ts +++ b/src/formats.ts @@ -32,12 +32,12 @@ export const defaultColorMatches = ( coverage >= style.stage1 ? 76 : coverage >= style.stage2 - ? Math.floor( + ? Math.floor( ((style.stage1 - coverage) / (style.stage1 - style.stage2)) * 10 ) * - 16 + + 16 + 76 - : 225 + Math.floor(coverage / (style.stage2 / 11)); + : 225 + Math.floor(coverage / (style.stage2 / 11)); const result = gradient.toString(16); return (result.length === 1 ? "0" : "") + result + "1"; }; @@ -75,11 +75,11 @@ const FormatsObj: FormatObj = { } }, - listFormats: function () { + listFormats: function() { return Object.keys(this.formats); }, - getFormat: function (format: string) { + getFormat: function(format: string) { return this.formats[format]; } }; -- cgit