diff options
Diffstat (limited to 'src/gen-thumbs.js')
-rw-r--r-- | src/gen-thumbs.js | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/src/gen-thumbs.js b/src/gen-thumbs.js index 6c82761f..3ccd8ce2 100644 --- a/src/gen-thumbs.js +++ b/src/gen-thumbs.js @@ -163,6 +163,7 @@ import { import dimensionsOf from 'image-size'; import CacheableObject from '#cacheable-object'; +import {stringifyCache} from '#cli'; import {commandExists, isMain, promisifyProcess, traverse} from '#node-utils'; import {sortByName} from '#sort'; @@ -346,28 +347,6 @@ export function getThumbnailsAvailableForDimensions([width, height]) { ]; } -function stringifyCache(cache) { - if (Object.keys(cache).length === 0) { - return `{}`; - } - - const entries = Object.entries(cache); - sortByName(entries, {getName: entry => entry[0]}); - - return [ - `{`, - entries - .map(([key, value]) => [JSON.stringify(key), JSON.stringify(value)]) - .map(([key, value]) => `${key}: ${value}`) - .map((line, index, array) => - (index < array.length - 1 - ? `${line},` - : line)) - .map(line => ` ${line}`), - `}`, - ].flat().join('\n'); -} - getThumbnailsAvailableForDimensions.all = Object.entries(thumbnailSpec) .map(([name, {size}]) => [name, size]) |