javascript swap an object's key code example
Example: reverse keys and values in object javascript
var object = { 'a': 1, 'b': 2, 'c': 1 };
//This uses the package lodash
_.invert(object);
// => { '1': 'c', '2': 'b' }
// with `multiValue`
_.invert(object, true);
// => { '1': ['a', 'c'], '2': ['b'] }