UNPKG

pragmatic-fp-ts

Version:

Opinionated functional programming library with easy use in mind

14 lines (13 loc) 419 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.invertObj = void 0; const main_1 = require("./main"); // inverts key->value to value->key object function invertObj(obj) { const dict = (0, main_1.getValueOr)({}, obj); return Object.keys(dict).reduce((accum, key) => { accum[String(dict[key])] = key; return accum; }, {}); } exports.invertObj = invertObj;