Created
          April 6, 2017 15:26 
        
      - 
      
- 
        Save artemsky/a3be78ec43ac698226b7661e28e354fd to your computer and use it in GitHub Desktop. 
    es6 Map to Json
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const mapToObject = (map) => { | |
| const out = Object.create(null); | |
| map.forEach((value, key) => { | |
| if (value instanceof Map) { | |
| out[key] = mapToObject(value); | |
| } | |
| else { | |
| out[key] = value | |
| } | |
| }); | |
| return out; | |
| }; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment