serkanyersen/jsonplus

resolve function not working as expected

thatisuday opened this issue · 1 comments

// resolve has a second argument, which provides the context for references
var object = resolve({ full: '{{ first }} {{ last }}' }, { first: 'john', last: 'doe' });

console.log(object) // { full: 'john doe' }

Does not compile template...

I've found the same problem, but I haven't been able to hack out a solution. Interestingly, this works:

var object = resolve({ first: 'john', last: 'doe', full: '{{ first }} {{ last }}' });

console.log(object) // { full: 'john doe' }

But the two-argument approach does not.

Edit: the console.log(object) returns the entire object, of course. console.log(object.full) gives just john doe.