You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
256 B

4 years ago
  1. 'use strict';
  2. module.exports = object => {
  3. if (typeof object !== 'object') {
  4. throw new TypeError('Expected an object');
  5. }
  6. const ret = {};
  7. for (const key of Object.keys(object)) {
  8. const value = object[key];
  9. ret[value] = key;
  10. }
  11. return ret;
  12. };