Created
October 1, 2018 18:58
-
-
Save bjruberg/b58aff25354a87ec9889c02efa2568b6 to your computer and use it in GitHub Desktop.
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
// native variant needs to protect against null values | |
const data = null | |
const result = Array.isArray(data) ? data.map(item => parseInt(item) : [] | |
// not so with lodash | |
const result = _.map(null, item => parseInt(item)) | |
// no exception, result is [] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment