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

Parse functions in parameters #5

Open
uiii opened this issue Jun 18, 2013 · 1 comment
Open

Parse functions in parameters #5

uiii opened this issue Jun 18, 2013 · 1 comment

Comments

@uiii
Copy link
Contributor

uiii commented Jun 18, 2013

When an interpolation token is used as a helper (scope function), allow parameters to be helper/function calls too.

E.g.

<div data-show="{{and(isFirst($index), infoIsDefined)}}">
    {{upperCase(replace(" ", "-", info))}}
</div>
@soundstep
Copy link
Owner

So There's a "issue-5" branch where I've enabled parsing function in parameters.

It works, however the regex to extract the params is a lot more complex.

https://github.com/soundstep/soma-template/blob/issue-5/src/2.settings.js#L76
versus
https://github.com/soundstep/soma-template/blob/master/src/2.settings.js#L75

That makes the lib slightly slower, even if you don't it as this regex is used constantly.

Master benchmarks:

  • render text node x 23,706 ops/sec ±1.77% (74 runs sampled)

Issue-5 benchmarks:

  • render text node x 21,470 ops/sec ±1.76% (90 runs sampled)

Benchmarks are on the repo:
https://github.com/soundstep/soma-template/tree/master/benchmarks

I need to finish to write the tests for the regex on issue-5, but as there are other solutions by passing only parameters, I'm not sure I'll add this functionality if I don't find a way to optimize and get performance.

I'll think about it.

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

No branches or pull requests

2 participants