OrderedMap to List to get the first item

Sort

by lau_chung

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.7.2/immutable.min.js"></script>

Babel + JSX

console.clear();

var list = {watch:{case:{case_material:{Something:0,Steel:2,Gold:31,Metal:0,Hello:78},caseback:{Steel:4,Gold:5,Plastic:10}}}}

var state = Immutable.fromJS(list,(key,value)=>{
   var isIndexed = Immutable.Iterable.isIndexed(value);
  return isIndexed ? value.toList() :value.toOrderedMap();
})

alert(state.getIn(['watch','case','case_material']).keySeq().toList().get(0))