Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to lodash 4 and safely test isArray #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jonalvarezz
Copy link

The current function that test if something is an array was failing for Mongoose 4.5.8, MongoDB 3.2.7, since the test value could be an String:

function isArray (t) {
  !isNaN(t.length)
}

isArray([2, 4, 4]) // true
isArray('something') // true (Should be false)

This changes updates lodash to version 4 and:

  • Use lodash isArray
  • Replace lodash pick for native JavaScript map
  • Selective imports for lodash (reduce final file size)

Let me know if something is missed.

- Use lodash cherrypicks imports to reduce file size
- _.pluck is replaced by natives map
Current validation fails if result[opts.idField] is a string
@jonalvarezz jonalvarezz mentioned this pull request Oct 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant