Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add context.clone and context.pop #559

Merged
merged 1 commit into from
Mar 24, 2015
Merged

Conversation

sethkinast
Copy link
Contributor

This is a starting point for discussion, probably not final.

I added the clone method because Chunk#partial can resolve partials asynchronously, so you run into closure issues if you don't clone the working context. But it's useful anyways.

Closes #558

if (obj.length > 0) {
return false;
}
for (key in obj) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object.keys is available in IE9+

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, my first version used Object.keys, but I benchmarked:

https://jsperf.com/empty-object-comparisons/8

prashn64 added a commit that referenced this pull request Mar 24, 2015
Add `context.clone` and `context.pop` and simplify chunk.partial.
@prashn64 prashn64 merged commit 9fca1f0 into linkedin:master Mar 24, 2015
@sethkinast sethkinast deleted the context-pop branch March 25, 2015 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request context#pop implementation
3 participants