logo

Grimgrains

Unnamed repository; edit this file 'description' to name the repository.
commit: 3cd5d3918657ba80e69ed9574fcbdcda888d2e24
parent e84bcba409b13e89f9c46bafd9d77a8475c65fd5
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Thu,  8 Mar 2018 10:31:14 +1300

Cleaned the indent node

Diffstat:

Mscripts/database/recipes.js8--------
Mscripts/nodes/database.js6++----
Mscripts/nodes/indental.js26+++++++++-----------------
3 files changed, 11 insertions(+), 29 deletions(-)

diff --git a/scripts/database/recipes.js b/scripts/database/recipes.js @@ -1,12 +1,5 @@ DATABASE.recipes = ` -ROOT - LEAF - LEAF - SOMETHING - LEAF - - SPINACH PAJEON DATE : 2014-08-19 TAGS : korean dinner sidedish @@ -15,7 +8,6 @@ SPINACH PAJEON DESC & A dish of korean inspiration! A delicious scallion pancake coloured green with spinach. This is a great way to add an extra portion of vegetables to your meal. & Happy cooking! - ? Rekka INST * Pancake - Blend 1/2 cup of spinach with 1/2 cup of water until smooth. Set aside. diff --git a/scripts/nodes/database.js b/scripts/nodes/database.js @@ -11,6 +11,4 @@ function DatabaseNode(id,rect) this.cache = this.cache ? this.cache : this.request(); return this.request(this.cache); } -} - -var DATABASE = {};- \ No newline at end of file +}+ \ No newline at end of file diff --git a/scripts/nodes/indental.js b/scripts/nodes/indental.js @@ -19,6 +19,7 @@ function IndentalNode(id,rect) function build(lines) { + // Assoc lines var stack = {} var target = lines[0] for(id in lines){ @@ -28,19 +29,14 @@ function IndentalNode(id,rect) if(target){ target.children.push(line) } stack[line.indent] = line } - return nip(lines); - } - function nip(lines) - { + // Format var h = {} - for(id in lines){ var line = lines[id]; if(line.skip || line.indent > 0){ continue; } h[line.content] = format(line) } - return h } @@ -50,15 +46,9 @@ function IndentalNode(id,rect) var h = {}; for(id in line.children){ var child = line.children[id]; - if(child.key){ - h[child.key] = child.value - } - else if(child.children.length == 0){ - a.push(child.content) - } - else{ - h[child.content] = format(child) - } + if(child.key){ h[child.key] = child.value } + else if(child.children.length == 0){ a.push(child.content) } + else{ h[child.content] = format(child) } } return a.length > 0 ? a : h } @@ -75,4 +65,6 @@ function IndentalNode(id,rect) } } } -}- \ No newline at end of file +} + +var DATABASE = {};+ \ No newline at end of file