初始化fy
This commit is contained in:
20
uni_modules/UniDevTools/node_modules/invert-kv/index.js
generated
vendored
Normal file
20
uni_modules/UniDevTools/node_modules/invert-kv/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = object => {
|
||||
if (typeof object !== 'object' || object === null) {
|
||||
throw new TypeError('Expected an object');
|
||||
}
|
||||
|
||||
const result = {};
|
||||
|
||||
for (const [key, value] of Object.entries(object)) {
|
||||
result[value] = key;
|
||||
}
|
||||
|
||||
for (const symbol of Object.getOwnPropertySymbols(object)) {
|
||||
const value = object[symbol];
|
||||
result[value] = symbol;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
Reference in New Issue
Block a user