Created
August 20, 2017 12:11
-
-
Save herber/1e22170ac69e82abc29da459a547bf75 to your computer and use it in GitHub Desktop.
Transform anything into an array.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const toArray = array => { | |
if (array instanceof Array) return array; | |
if (array === null || array === undefined) return []; | |
return [array]; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment