JSFiddle - React, Tailwind, and code Playground
by darcyclarke
JavaScript
var files = [{ path: 'README.md' },
{ path: 'source/index.html' },
{ path: 'source/assets/styles/css/styles.css' },
{ path: 'source/assets/scripts/js/scripts.js' }],
parsed = [];
$.each(files, function(e, el){
var route = this.path.split("/");
if(route.length > 1){
route = route.splice(0,(route.length-1));
route = route.join('/');
} else {
route = '...';
}
if(typeof parsed[route] == 'undefined')
parsed[route] = [];
parsed.length++;
parsed[route].push(this);
});