webpack/lib/util/objectToMap.js

16 lines
369 B
JavaScript
Raw Normal View History

2018-07-30 23:08:51 +08:00
/*
MIT License http://www.opensource.org/licenses/mit-license.php
*/
"use strict";
/**
* Convert an object into an ES6 map
2025-03-27 08:07:25 +08:00
* @template {object} T
* @param {T} obj any object type that works with Object.entries()
* @returns {Map<string, T[keyof T]>} an ES6 Map of KV pairs
*/
module.exports = function objectToMap(obj) {
return new Map(Object.entries(obj));
};