Skip to content

_.invert() throws an error on a specific JSON object #3260

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

Closed
radekk opened this issue Jul 12, 2017 · 4 comments
Closed

_.invert() throws an error on a specific JSON object #3260

radekk opened this issue Jul 12, 2017 · 4 comments
Labels

Comments

@radekk
Copy link

radekk commented Jul 12, 2017

JSFiddle: https://jsfiddle.net/mem9e9r9/
Error: TypeError: Cannot convert object to primitive value
Description:
It seems like invert() function is triggering an error when converting json object with builtin -> toString property present. I tried with standard JSON files and it does work properly.

It fails to run _.invert() on this JSON object:

{
  "builtin": {
    "toString": false
  }
}
@jdalton
Copy link
Member

jdalton commented Jul 12, 2017

Thanks @radekk!

@radekk
Copy link
Author

radekk commented Jul 13, 2017

@jdalton Thanks John for fixing this issue. How should I install this fix through npm? I tried with:

npm i 'lodash/lodash#01148a1df881b7b1f2cd92626bbdb330176ca1b1' --save

But it's not generating the index.js file in node_modules/lodash/ directory and furthermore node.js is not able to load that module.

@jdalton
Copy link
Member

jdalton commented Jul 13, 2017

It'll be in v5 (whenever that's released).

@lock
Copy link

lock bot commented Dec 27, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.