Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

converting immutable fromJS object back to json

Tags:

immutable.js

I want to be able to look at my immutable objects for debugging. I find it very difficult to look through an object by clicking on entries and such. Ideally what I would like is the opposite of the formJS function

so,

const immutableObj = fromJS({name: 'bob'})
return oppositeJS(immutableObj)  
=> {name: 'bob'}
like image 937
DrivingInsanee Avatar asked Feb 10 '16 19:02

DrivingInsanee


2 Answers

Just use toJS() To read more about https://devdocs.io/immutable/index#map.tojs

const immutableObj = fromJS({name: 'bob'})

const backToObj = immutableObj.toJS();
like image 83
Armando Júnior Avatar answered Nov 20 '22 09:11

Armando Júnior


nevermind, I found it in the documentation

toJS()
like image 45
DrivingInsanee Avatar answered Nov 20 '22 08:11

DrivingInsanee