Last active
July 2, 2019 10:32
-
-
Save ranwahle/c835c033074ee3c963307a4060c8347f to your computer and use it in GitHub Desktop.
Map aray with validation
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
export const mapArrayItems = (data = []) => { | |
if (!Array.isArray(data)) { | |
return null; | |
} | |
return data.map((item) => { | |
// some mapping | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment