From 5981f69fac3e0d303425b8df125cd9e705c9eea8 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 2 Jun 2023 12:42:26 -0300 Subject: content: generateArtistInfoPage: artwork contributions This actually covers the foundations for other types of contribs too. It's hopefully a fair bit cleaner and easier to follow than the previous data processing for this page! --- src/util/sugar.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/util') diff --git a/src/util/sugar.js b/src/util/sugar.js index 0362e327..6ab70bc6 100644 --- a/src/util/sugar.js +++ b/src/util/sugar.js @@ -82,6 +82,14 @@ export const compareArrays = (arr1, arr2, {checkOrder = true} = {}) => export const withEntries = (obj, fn) => Object.fromEntries(fn(Object.entries(obj))); +export function filterProperties(obj, properties) { + const set = new Set(properties); + return Object.fromEntries( + Object + .entries(obj) + .filter(([key]) => set.has(key))); +} + export function queue(array, max = 50) { if (max === 0) { return array.map((fn) => fn()); -- cgit 1.3.0-6-gf8a5