mirror of https://github.com/MaxLeiter/Drift
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
392 B
JavaScript
21 lines
392 B
JavaScript
'use strict';
|
|
|
|
module.exports = object => {
|
|
if (typeof object !== 'object' || object === null) {
|
|
throw new TypeError('Expected an object');
|
|
}
|
|
|
|
const result = {};
|
|
|
|
for (const [key, value] of Object.entries(object)) {
|
|
result[value] = key;
|
|
}
|
|
|
|
for (const symbol of Object.getOwnPropertySymbols(object)) {
|
|
const value = object[symbol];
|
|
result[value] = symbol;
|
|
}
|
|
|
|
return result;
|
|
};
|