Fixing user preferences saving issues

This commit is contained in:
Bruno Alves de Faria committed 2017-10-11 08:55:10 -03:00
1 parent f19ef98f5f
commit 15f04a5790
5 files changed
+26 -17

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
import './lib';
import './utils';
import './schema.js';
+1
View File
@@ -0,0 +1 @@
import './object.js';
@@ -4,13 +4,14 @@ OHIF.object = {};
// Transforms a shallow object with keys separated by "." into a nested object
OHIF.object.getNestedObject = shallowObject => {
var nestedObject = {};
for (var key in shallowObject) {
var value = shallowObject[key];
var propertyArray = key.split('.');
var currentObject = nestedObject;
const nestedObject = {};
for (let key in shallowObject) {
if (!shallowObject.hasOwnProperty(key)) continue;
const value = shallowObject[key];
const propertyArray = key.split('.');
let currentObject = nestedObject;
while (propertyArray.length) {
var currentProperty = propertyArray.shift();
const currentProperty = propertyArray.shift();
if (!propertyArray.length) {
currentObject[currentProperty] = value;
} else {
@@ -28,11 +29,12 @@ OHIF.object.getNestedObject = shallowObject => {
// Transforms a nested object into a shallowObject merging its keys with "." character
OHIF.object.getShallowObject = nestedObject => {
var shallowObject = {};
var putValues = function(baseKey, nestedObject, resultObject) {
for (var key in nestedObject) {
var currentKey = baseKey ? baseKey + '.' + key : key;
var currentValue = nestedObject[key];
const shallowObject = {};
const putValues = (baseKey, nestedObject, resultObject) => {
for (let key in nestedObject) {
if (!nestedObject.hasOwnProperty(key)) continue;
let currentKey = baseKey ? `${baseKey}.${key}` : key;
const currentValue = nestedObject[key];
if (typeof currentValue === 'object') {
if (currentValue instanceof Array) {
currentKey += '[]';
-1
View File
@@ -1,6 +1,5 @@
import './blaze.js';
import './cornerstone.js';
import './object.js';
import './string.js';
import './ui.js';
import './utils.js';