-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Splat redux with es6-ish syntax #1149
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,6 +85,22 @@ export function template(templateSpec, env) { | |
| return typeof current === 'function' ? current.call(context) : current; | ||
| }, | ||
|
|
||
| splat: function() { | ||
| return Utils.extend.apply(null, arguments); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the first argument passed here? Are we ok with it being modified in all cases?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just saw this so please disregard :) Do we have test coverage asserting that the first object is not mutated? |
||
| }, | ||
|
|
||
| splatArgs: function(splatMap, ...values) { | ||
| let args = []; | ||
| for (let i = 0, l = values.length; i < l; ++i) { | ||
| if (splatMap[i]) { | ||
| args.push.apply(args, values[i]); | ||
| } else { | ||
| args.push(values[i]); | ||
| } | ||
| } | ||
| return args; | ||
| }, | ||
|
|
||
| escapeExpression: Utils.escapeExpression, | ||
| invokePartial: invokePartialWrapper, | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any thoughts on performance/code size of this vs. array with missing values notation? I.e.
[,,1]vs.{"2":1}.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, don't have the perf wizard knowledge myself.