From 06b3f481bd1e09c26be36aece3fe614c7971c848 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Fri, 26 May 2017 13:45:01 +0300 Subject: [PATCH] gallery refactoring --- src/routes/gallery.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/routes/gallery.js b/src/routes/gallery.js index faefe477..1b756068 100644 --- a/src/routes/gallery.js +++ b/src/routes/gallery.js @@ -2,6 +2,7 @@ const React = require('react') const Article = require('../components/Article') const Album = require('../core/Album') const {render} = require('../lib/render') +const {splitBy} = require('../lib/array') const getPathWithNoTrailingSlash = require('../lib/url').getPathWithNoTrailingSlash const {get} = require('koa-route') @@ -36,17 +37,6 @@ const ACollection = ({title, albums}) => ( ) -function splitBy(key) { - return items => { - return items.reduce((acc, item) => { - const name = key(item) - const items = acc.get(name) || [] - - return acc.set(key(item), [...items, item]) - }, new Map()) - } -} - function getGallery() { return get('/gallery', async ctx => { const path = getPathWithNoTrailingSlash(ctx.path)