1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-08-22 17:02:58 +02:00

Add group age

This commit is contained in:
Kamran Ahmed
2021-12-04 12:21:06 +01:00
parent 8a526f51b9
commit 7256c93d85
31 changed files with 186 additions and 28 deletions

View File

@@ -167,11 +167,13 @@ function createDirTree(
const childrenDirNames = Object.keys(dirTree);
const hasChildren = childrenDirNames.length !== 0;
// @todo write test for this, yolo for now
const groupName = parentDir
.replace(roadmapContentDirPath, '') // Remove base dir path
.replace(/(^\/)|(\/$)/g, '') // Remove trailing slashes
.replace(/(^\d+?-)/g, '') // Remove sorting information
.replace('/', ':'); // Replace slashes with `:`
.replaceAll('/', ':') // Replace slashes with `:`
.replace(/:\d+-/, ':');
const sortOrder = sortOrders[groupName] || '';