mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Allow RED.settings.set to replace string property with object property
This commit is contained in:
parent
bc17ebd90e
commit
468ef7ecff
@ -36,7 +36,15 @@ function extend(target, source) {
|
|||||||
} else {
|
} else {
|
||||||
// Object
|
// Object
|
||||||
if (target.hasOwnProperty(keys[i])) {
|
if (target.hasOwnProperty(keys[i])) {
|
||||||
|
// Target property exists. Need to handle the case
|
||||||
|
// where the existing property is a string/number/boolean
|
||||||
|
// and is being replaced wholesale.
|
||||||
|
var targetType = typeof target[keys[i]];
|
||||||
|
if (targetType === 'string' || targetType === 'number' || targetType === 'boolean') {
|
||||||
|
target[keys[i]] = value;
|
||||||
|
} else {
|
||||||
target[keys[i]] = extend(target[keys[i]],value);
|
target[keys[i]] = extend(target[keys[i]],value);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
target[keys[i]] = value;
|
target[keys[i]] = value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user