944720d38210f139062b15c2fe8843d4a72a77cd5f583f6d83639bff933263cb16069fe58ac7ea4846ec5881c33736b268ce87e84002c051c378e7390287ce 405 B

12345678910111213141516
  1. /**
  2. * convert an object into its 2D array equivalent to be turned
  3. * into an ES6 map
  4. *
  5. * @param {object} obj any object type that works with Object.keys()
  6. * @returns {Map<TODO, TODO>} an ES6 Map of KV pairs
  7. */
  8. module.exports = function objectToMap(obj) {
  9. return new Map(
  10. Object.keys(obj).map(key => {
  11. /** @type {[string, string]} */
  12. const pair = [key, obj[key]];
  13. return pair;
  14. })
  15. );
  16. };