Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Changing [].flatten to array wrapper method#977

Open
rahul-tapali wants to merge 1 commit intoryanb:masterfrom
rahul-tapali:master
Open

Changing [].flatten to array wrapper method#977
rahul-tapali wants to merge 1 commit intoryanb:masterfrom
rahul-tapali:master

Conversation

@rahul-tapali
Copy link
Copy Markdown

Changing [].flatten to array wrapper method

   [[1,2,3]].flatten <=> Array([1,2,3])   =>  [1,2,3]
   [1].flatten    <=>   Array(1)    => [1]

And this will avoid the nil value

   [nil].flatten   => [nil]
   Array(nil)    =>  []

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants