From a6d7ad17150eb98536c1555f7e61c2022f9275d1 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Fri, 29 Jan 2021 11:39:02 +0100 Subject: [PATCH] Update 0BDFDB.plugin.js --- Library/0BDFDB.plugin.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Library/0BDFDB.plugin.js b/Library/0BDFDB.plugin.js index 013c0a15ac..767d03e888 100644 --- a/Library/0BDFDB.plugin.js +++ b/Library/0BDFDB.plugin.js @@ -312,6 +312,12 @@ module.exports = (_ => { BDFDB.ObjectUtils.isEmpty = function (obj) { return !BDFDB.ObjectUtils.is(obj) || Object.getOwnPropertyNames(obj).length == 0; }; + BDFDB.ObjectUtils.mirror = function (obj) { + if (!BDFDB.ObjectUtils.is(obj)) return {}; + let newObj = Object.assign({}, obj); + for (let key in newObj) newObj[newObj[key]] = key; + return newObj; + }; BDFDB.ArrayUtils = {}; BDFDB.ArrayUtils.is = function (array) {