From 021a05ee1c038354a281b48469e92f7cbb565fe4 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Wed, 25 May 2022 13:23:12 -0500 Subject: [PATCH] Add makeSummaryOfListings helper --- helpers/categories.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/helpers/categories.js b/helpers/categories.js index f76fb1e..0e36064 100644 --- a/helpers/categories.js +++ b/helpers/categories.js @@ -246,3 +246,10 @@ export function findCategoryForTagsSet ( tags ) { return null } + +export function makeSummaryOfListings ({ list, length = 25 } = {}) { + return list + .slice(0, length) + .map( listing => listing.name ) + .join(', ') + ', etc...' +}