Skip to content

Commit

Permalink
Make data files preserve dots in keys instead of using them as paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Dermah committed Jun 9, 2020
1 parent d3dfcec commit 0b88d8d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/TemplateData.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,12 @@ class TemplateData {
let folders = parsed.dir ? parsed.dir.split("/") : [];
folders.push(parsed.name);

return folders.join(".");
// Folders reduce to `folder["subfolder"]["subsubfolder"]`...
const reduction = folders.reduce((acc, cur, i) =>
i === 0 ? cur : `${acc}["${cur}"]`
);

return reduction;
}

async getAllGlobalData() {
Expand Down

0 comments on commit 0b88d8d

Please sign in to comment.