Skip to content

Scott lab #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions scott-lab/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/node_modules/*
**/vendor/*
**/*.min.js
1 change: 1 addition & 0 deletions scott-lab/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
File renamed without changes.
43 changes: 43 additions & 0 deletions scott-lab/lib/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict'

const fs = require('fs')

const Node = function(element, data){
this.element = element,
this.data = data,
this.children = []
}


module.exports = exports = {}

exports.DOMparse = function(){
// fs.readfile(htmlFile)
let str
fs.readFile(`${__dirname}/../../assets/minimal.html`, 'utf-8', function(err, data){
if(err) throw err
str = data.toString()
// console.log(str)

let openSplit = str.split('<') //(/<^[a-zA-Z0-9]+$>/)
// console.log(openSplit);
console.log(openSplit.length);
let elements = openSplit.map(item => item.split('>'))

let stack = []

for(let i =0; i < elements.length; i++) {
let item = elements[i]
if(item[0][0] !== '!' && item[0][0] !== ''){
if(item[0][0] !== '/'){
let node = new Node(item[0], item[1])
stack.push(node)
// if(stack)
}
}
}
console.log(stack);
})

}
exports.DOMparse()
22 changes: 22 additions & 0 deletions scott-lab/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "25-career-development",
"version": "1.0.0",
"description": "![cf](http://i.imgur.com/7v5ASc8.png) lab 25 - Tree Data Structure ====",
"main": "app.js",
"scripts": {
"test": "mocha"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ScottBrenden/25-career-development.git"
},
"author": "scott",
"license": "ISC",
"bugs": {
"url": "https://github.com/ScottBrenden/25-career-development/issues"
},
"homepage": "https://github.com/ScottBrenden/25-career-development#readme",
"dependencies": {
"fs": "0.0.1-security"
}
}