madiator.com/ui/util/swap-json.js

10 lines
176 B
JavaScript
Raw Normal View History

2021-08-16 12:11:25 +02:00
export function swapKeyAndValue(dict) {
const ret = {};
for (const key in dict) {
if (dict.hasOwnProperty(key)) {
ret[dict[key]] = key;
}
}
return ret;
}