Skip to content

Instantly share code, notes, and snippets.

@klaytonfaria
Created February 6, 2014 18:31
Show Gist options
  • Save klaytonfaria/cb67fd7317fac104cd52 to your computer and use it in GitHub Desktop.
Save klaytonfaria/cb67fd7317fac104cd52 to your computer and use it in GitHub Desktop.
dust.scopes = {};
dust.helpers.addToScope = function(chunk, context, bodies, params) {
return chunk.capture(bodies.block, context, function(out, chunk) {
var parts = params.key.split("."),
scopeKey = parts[0],
key = parts[1],
scope = dust.scopes[scopeKey] || {};
scope[key] = out;
dust.scopes[scopeKey] = scope;
chunk.end();
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment