Skip to content

Instantly share code, notes, and snippets.

@kvasdopil
Forked from tuor4eg/justDuIt
Last active April 16, 2018 13:43
Show Gist options
  • Save kvasdopil/f2a2773e4a4d4540538ed2a5d4ee7ac8 to your computer and use it in GitHub Desktop.
Save kvasdopil/f2a2773e4a4d4540538ed2a5d4ee7ac8 to your computer and use it in GitHub Desktop.
export const countSize = (node) => {
reduce((size, element) => {
if (element.type === 'file') {
return (size + element.meta.size);
}
return size;
}, node, 0);
export default (tree) => {
const duIt = tree
.children
.map(element => [element.name, countSize(element)])
.sort((a, b) => a[1] - b[1]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment