From 26105034da4fcce7ac883c899d781f016559310d Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 8 Nov 2018 00:38:48 +0800 Subject: switch to vuepress --- node_modules/webpack/lib/util/objectToMap.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 node_modules/webpack/lib/util/objectToMap.js (limited to 'node_modules/webpack/lib/util/objectToMap.js') diff --git a/node_modules/webpack/lib/util/objectToMap.js b/node_modules/webpack/lib/util/objectToMap.js new file mode 100644 index 00000000..31713646 --- /dev/null +++ b/node_modules/webpack/lib/util/objectToMap.js @@ -0,0 +1,16 @@ +/** + * convert an object into its 2D array equivalent to be turned + * into an ES6 map + * + * @param {object} obj - any object type that works with Object.keys() + * @returns {Map} an ES6 Map of KV pairs + */ +module.exports = function objectToMap(obj) { + return new Map( + Object.keys(obj).map(key => { + /** @type {[string, string]} */ + const pair = [key, obj[key]]; + return pair; + }) + ); +}; -- cgit v1.2.3