Context.prototype.get doesn't support nested objects #176

Closed
kilianc opened this Issue Oct 15, 2012 · 3 comments

Comments

Projects
None yet
2 participants
Contributor

kilianc commented Oct 15, 2012

var base = dust.makeBase({ a: { b: { c: 'foo' } } })
console.log(base.get('a.b.c')) // === undefined
console.log(base.get('a')) // === [object Object]
Contributor

vybs commented Oct 15, 2012

try getPath for console.log(base.get('a.b.c'))

Contributor

kilianc commented Oct 15, 2012

The problem is that dust calls get when it renders the template

Kilian C.

On Monday, October 15, 2012 at 5:47 PM, Veena Basavaraj wrote:

try getPath for console.log(base.get('a.b.c'))


Reply to this email directly or view it on GitHub (#176 (comment)).

Contributor

vybs commented Oct 15, 2012

AFAIK, when it sees a dot notation, it compiles to getPath.

{a.b.c}

function() {
dust.register("demo", body_0);

function body_0(chk, ctx) {
return chk.reference(ctx.getPath(false, ["a", "b", "c"]), ctx, "h");
}
return body_0;
})();

@vybs vybs closed this Jul 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment