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

Consider converting from for-loops to forEach function calls #89

Open
1fifoto opened this issue Jul 10, 2018 · 0 comments
Open

Consider converting from for-loops to forEach function calls #89

1fifoto opened this issue Jul 10, 2018 · 0 comments
Assignees

Comments

@1fifoto
Copy link
Contributor

1fifoto commented Jul 10, 2018

For example

        if (!hits) {
            for (let i = 0; i < design.design_parameters.length; i++) {
                var dp = design.design_parameters[i];
                if (dp.name.startsWith(subcommand)) {
                    putdpsv(dp.name, dp.value, dp.units, dp);
                    hits = true;
                }
            }
        }

to

        if (!hits) {
            design.design_parameters.forEach(function(dp) {
                if (dp.name.startsWith(subcommand)) {
                    putdpsv(dp.name, dp.value, dp.units, dp);
                    hits = true;
                }
            }
        }

This is more of a Javascript idiom, and simplifies the code.

@1fifoto 1fifoto added this to the future such as pcyl-web milestone Jul 10, 2018
@1fifoto 1fifoto self-assigned this Jul 10, 2018
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

1 participant