mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Clone settings to avoid modifying original values
This commit is contained in:
parent
9a32e79603
commit
d4a21be666
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var when = require("when");
|
var when = require("when");
|
||||||
|
var clone = require("clone");
|
||||||
var assert = require("assert");
|
var assert = require("assert");
|
||||||
|
|
||||||
var userSettings = null;
|
var userSettings = null;
|
||||||
@ -45,12 +45,12 @@ var persistentSettings = {
|
|||||||
},
|
},
|
||||||
get: function(prop) {
|
get: function(prop) {
|
||||||
if (userSettings.hasOwnProperty(prop)) {
|
if (userSettings.hasOwnProperty(prop)) {
|
||||||
return userSettings[prop];
|
return clone(userSettings[prop]);
|
||||||
}
|
}
|
||||||
if (globalSettings === null) {
|
if (globalSettings === null) {
|
||||||
throw new Error("Settings not available");
|
throw new Error("Settings not available");
|
||||||
}
|
}
|
||||||
return globalSettings[prop];
|
return clone(globalSettings[prop]);
|
||||||
},
|
},
|
||||||
|
|
||||||
set: function(prop,value) {
|
set: function(prop,value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user