Not sure how subjective this question is however I am looking for a peer review and general feedback on the intuitiveness and scaffolding potential of a framework concept. I have a gist on GitHub here: node.js MVVM framework concept
Is this more or less intuitive then using pseudo code and a template engine, such as handlebars, for rendering html?
The markup module will use three objects, the first being out design object:
var welcomeDesign = [{
handle:'pageTitle'
tag:'h1',
attr:{
class:'mainHeading'
}
},{
tag:'p',
handle:'welcomeParagraph',
content:[{
content:'Welcome!',
handle:'welcomeContent'
},{
tag:'img'
handle:'welcomeBanner'
}]
}];
The second object is our data:
var data = [{
published:'11-8-13',
title:'Hello World',
content:'Welcome to...'
assets:[{
type:'img',
path:'/images/'
name:'cat.jpg'
}]
}];
The third will be our mapping logic:
var imageAsset = {
attr:{
src:{
key:'assets',
map:function(obj, values){
return values[0].path + values[0].name
}
}
}
};
var welcome = {
pageTitle:{
content: {
key:['published','title']
map: function(object, values){
return values[0] + ': ' + values[1];
}
}
},
welcomeContent:{
content:{
key:'content'
}
},
welcomeBanner:imageAsset
};
and finally the methods for bringing them together:
var markup = require('markup'); //our module
var welcomeMessage = markup.design(welcomeDesign); //create a design instance
var homeWelcome = new welcomeMessage(data); //instantiate with our data
homeWelcome.render(welcome); //render with our logic