1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  */
    
  7. 'use strict';
    
  8. 
    
  9. /**
    
  10.  * turns
    
  11.  *   { 'MUCH ERROR': '0', 'SUCH WRONG': '1' }
    
  12.  * into
    
  13.  *   { 0: 'MUCH ERROR', 1: 'SUCH WRONG' }
    
  14.  */
    
  15. function invertObject(targetObj) {
    
  16.   const result = {};
    
  17.   const mapKeys = Object.keys(targetObj);
    
  18. 
    
  19.   // eslint-disable-next-line no-for-of-loops/no-for-of-loops
    
  20.   for (const originalKey of mapKeys) {
    
  21.     const originalVal = targetObj[originalKey];
    
  22. 
    
  23.     result[originalVal] = originalKey;
    
  24.   }
    
  25. 
    
  26.   return result;
    
  27. }
    
  28. 
    
  29. module.exports = invertObject;