summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/nfvo-utils
diff options
context:
space:
mode:
authorsvishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>2018-11-05 12:11:30 +0200
committerEinav Keidar <einavw@amdocs.com>2018-12-03 09:27:16 +0000
commitbacc715f10f5c648d61f0720120b14aadebf9a77 (patch)
treeb3dfb96845fff76f36d723261d6ad92d23271318 /openecomp-ui/src/nfvo-utils
parentc97bae74316ddae5121dc361a7631a8cdaa335b0 (diff)
keyMirror with namespace
Issue-ID: SDC-1873 Change-Id: Ib8e810397578610cd7e0cba64e10ecc38d67f5eb Signed-off-by: svishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>
Diffstat (limited to 'openecomp-ui/src/nfvo-utils')
-rw-r--r--openecomp-ui/src/nfvo-utils/KeyMirror.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/openecomp-ui/src/nfvo-utils/KeyMirror.js b/openecomp-ui/src/nfvo-utils/KeyMirror.js
index dc351af57c..c83b759b7f 100644
--- a/openecomp-ui/src/nfvo-utils/KeyMirror.js
+++ b/openecomp-ui/src/nfvo-utils/KeyMirror.js
@@ -1,5 +1,5 @@
/*!
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2016-2018 European Support Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,10 +13,11 @@
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
-var keyMirror = function(obj) {
- var ret = {};
- var key;
- var val;
+import UUID from 'uuid-js';
+const keyMirror = (obj, namespace) => {
+ let ret = {};
+ let key;
+ let val;
if (!(obj instanceof Object && !Array.isArray(obj))) {
throw new Error('keyMirror(...): Argument must be an object.');
}
@@ -24,11 +25,11 @@ var keyMirror = function(obj) {
if (obj.hasOwnProperty(key)) {
val = obj[key];
if (val instanceof Object) {
- ret[key] = keyMirror(obj[key]);
+ ret[key] = keyMirror(obj[key], namespace);
} else if (val !== null && val !== undefined) {
ret[key] = val;
} else {
- ret[key] = Symbol(key);
+ ret[key] = `${namespace ? namespace : UUID.create()}/${key}`;
}
}
}