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

POC: Add template forEach function and change it to forEach implementation #45

Open
korzio opened this issue Aug 11, 2017 · 0 comments
Open
Milestone

Comments

@korzio
Copy link
Owner

korzio commented Aug 11, 2017

As a djv validator developer
I want to have a template forEach function to easily construct cicles for validator functions

Example:
Instead of

tpl('for ($1; $2 < $3.length; $2++) {', tpl.cache('0'), tpl.cache('0'), tpl.data);
  tpl.data.push(`[${tpl.cache('0')}]`);

  const condition = `...`;
  const error = `...`;

  tpl(`if (${condition}) ${error}`, tpl.data);
  tpl.data.pop();

I want smth like

tpl.forEach(tpl.data, () => condition, () => error) // or even map
@korzio korzio added this to the 2.0.1 milestone Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant