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

Add Flatten function #1

Open
aswinkarthik opened this issue Oct 12, 2019 · 4 comments
Open

Add Flatten function #1

aswinkarthik opened this issue Oct 12, 2019 · 4 comments

Comments

@aswinkarthik
Copy link
Contributor

API:

array1 := []int{1,2,3}
array2 := []int{4,5,6}
array3 := []int{7,8,9}
var ouput []int

godash.Flatten(&output, array1, array2, array3)

// output should be []int{1,2,3,4,5,6,7,8,9}
@arunvelsriram arunvelsriram self-assigned this Oct 13, 2019
@aswinkarthik
Copy link
Contributor Author

Flatten can easily be implemented using consecutive append calls. I am having doubts if flatten will help @arunvelsriram

@arunvelsriram
Copy link
Member

arunvelsriram commented Oct 13, 2019

I think it's okay since lodash is providing it even though it could be achieved by a series of concat().

a = [1,2,3]
b = [4,5,6]
c = [7, 8, 9]
d = a.concat(b).concat(c) 
// d = [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]

@sharath2106
Copy link

sharath2106 commented Oct 14, 2019

@arunvelsriram @aswinkarthik I can take this up.

@arunvelsriram
Copy link
Member

arunvelsriram commented Oct 15, 2019

Sure go ahead.

@aswinkarthik could you share the deep flatten idea we discussed offline?

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

3 participants