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 props = {"time":1473264242,"pager":null,"page_type":"watch","key_name":"list","action":"update","post_id":"267","status":"1","user_id":124,"intro":"k888 \u00c2\u00a08 8 \u00c2\u00a088 j\r\n\u00c2\u00a078 78 787 8778\r\n78788787 7878\r\n\u00c2\u00a078 78 78 8778","title":"yjuyjjyuj yujuyj uyjuyjuy ujy yuj jyu juy","item":{"538":{"name":"Oris ProDiver Date ~ 01733764671540782671","page_type":"watch","brand_mid":"16","price":null,"mid":"538","model_id":"319","same_image":null,"calibre_mid":"546","sequence":1,"list_item_id":"267","comment":"\u00c2\u00a0okio kio ki 8 78 jj j\r\n\u00c2\u00a0888j8j8 j\r\n8 78 7878 78 78 j j78"},"1955":{"name":"HMT Surabhi","page_type":"watch","brand_mid":"100","price":null,"mid":"1955","model_id":"1213","same_image":null,"calibre_mid":"926","sequence":10,"list_item_id":"267","comment":"jib7uj7j7 iuj \u00c2\u00a0j778 7878\r\nb78jjj8j8j\r\nj8b78b78bjb8b788b7b78"}}}
var data = Immutable.fromJS(props,(key, value)=>{
var isIndexed = Immutable.Iterable.isIndexed(value);
return isIndexed ? value.toList() :value.toOrderedMap();
});
var sorted = data.get('item').sortBy(
(item) => item.get('sequence'));
console.log(sorted.toJS())