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

fun.STRUCT in plasm-fun.js #40

Open
Rayzen opened this issue Sep 21, 2012 · 0 comments
Open

fun.STRUCT in plasm-fun.js #40

Rayzen opened this issue Sep 21, 2012 · 0 comments

Comments

@Rayzen
Copy link

Rayzen commented Sep 21, 2012


/**
   * STRUCT
   * 
   * @param {Array} items
   * @return {plasm.Model}
   * @api public
   */

  fun.STRUCT = function (items) {
    var transformations = function (o) {return o;};
    var objects = [];

    temp = [];

    items.forEach(function (item) {
      if (!(item instanceof plasm.Model) && 
          !(item instanceof plasm.Struct)) {
        transformations = COMP2([transformations, item]);
      } else {
        temp.push(APPLY([transformations, item]).clone());
        objects.push(APPLY([transformations, item]));
      }
    });

    return new plasm.Struct(objects, p);
  };

What's the necessity of the temp array in this code? it is declared locally, not visible outside the function, it isn't returned and it isn't never used (except that it is filled with clones of the items)...

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