This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathharness.js
90 lines (68 loc) · 2.27 KB
/
harness.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const str = `module.exports = "<p>some html dude</p>"`
const what = [str]
// class Book {
// // pages is an array of Page objects
// constructor(title, pages) {
// this.title = title;
// this.allPages = pages;
// this.sections = [];
// this.pages = [];
// pages.forEach(page => {
// var parts = page.path.split("/");
// if(parts.length < 2) {
// //noop
// }
// else if(parts.length == 2) {
// this.pages.push(page);
// } else {
// var sectionParts = parts.splice(1, parts.length - 2);
// var currentSections = this.sections;
// var current = null;
// sectionParts.forEach(newSection => {
// current = currentSections.find(s => s.name === newSection);
// if(current == null) {
// current = new Section(newSection);
// currentSections.push(current);
// }
// currentSections = current.sections;
// });
// current.pages.push(page);
// }
// });
// }
// }
// class Section {
// constructor(name) {
// this.name = name;
// this.pages = [];
// this.sections = [];
// }
// }
// // represents a page in the book
// class Page {
// //name, full path of the page in the form ./folder/pagename.html, contents of the page
// constructor(name, path, content) {
// this.name = name;
// this.path = path;
// this.content = content;
// }
// }
// var pages = [
// new Page("one", "./one.html", "page one content"),
// new Page("two", "./two.html", "page two content"),
// new Page("three", "./a/three.html", "page three content"),
// new Page("four", "./b/four.html", "page four content"),
// new Page("five", "./b/ab/five.html", "page five content")
// ];
// var testBook = new Book('test', pages);
// console.log(testBook);
// var json = JSON.stringify(testBook, null, 2)
// console.log(json);
// var book = require('./src/book');
const json = JSON.stringify(str)
// const obj = JSON.parse(str)
var fs = require('fs');
var rawContent = fs.readFileSync("src/pages/PageOrder.json");
var pageOrder = JSON.parse(rawContent);
console.log(pageOrder);
console.log(str)