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

Array helper: concat #330

Open
ericcornelissen opened this issue Sep 27, 2018 · 1 comment
Open

Array helper: concat #330

ericcornelissen opened this issue Sep 27, 2018 · 1 comment

Comments

@ericcornelissen
Copy link

Hey, awesome project. I just wanted to ask if anyone besides me is interested in a concat helper for arrays (and possibly other types as well, such as strings?). If so I would be interested in creating a PR for that.

Since I'm already using this helper myself, here is the code for it:

module.exports = function(arrayA, arrayB, options) {
  if (Array.isArray(arrayA) && !Array.isArray(arrayB)) {
    return arrayA;
  } else if (Array.isArray(arrayA) && Array.isArray(arrayB)) {
    return arrayA.concat(arrayB);
  } else {
    return [];
  }
}
@doowb
Copy link
Member

doowb commented Sep 27, 2018

Thanks for the issue! A PR would be great and we can discuss any details in there.

Thanks!

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