Skip to content

Instantly share code, notes, and snippets.

@ranwahle
Last active July 2, 2019 10:32
Show Gist options
  • Save ranwahle/c835c033074ee3c963307a4060c8347f to your computer and use it in GitHub Desktop.
Save ranwahle/c835c033074ee3c963307a4060c8347f to your computer and use it in GitHub Desktop.
Map aray with validation
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