UNPKG

linguist-js

Version:

Analyse the programming languages used in a folder or from raw content, using the same rules that GitHub Linguist does.

12 lines (11 loc) 367 B
export default function treeOutput(args, data) { const treeParts = args.tree.split('.'); let nestedData = data; for (const part of treeParts) { if (!nestedData[part]) { throw Error(`TraversalError: Key '${part}' cannot be found on output object.`); } nestedData = nestedData[part]; } console.log(nestedData); }