@telefonica/language-model-converter
Advanced tools
Comparing version 2.5.0 to 2.5.1
@@ -214,8 +214,23 @@ "use strict"; | ||
for (const key in source) { | ||
if (isObject(source[key])) { | ||
if (!source[key]) { | ||
continue; | ||
} | ||
else if (isObject(source[key])) { | ||
if (!target[key]) { | ||
Object.assign(target, { [key]: {} }); | ||
} | ||
if (!isObject(target[key])) { | ||
throw new Error(`Property ${key} already exist in target but it is not an object`); | ||
} | ||
mergeDeep(target[key], source[key]); | ||
} | ||
else if (Array.isArray(source[key])) { | ||
if (!target[key]) { | ||
Object.assign(target, { [key]: [] }); | ||
} | ||
if (!Array.isArray(target[key])) { | ||
throw new Error(`Property ${key} already exist in target but it is not an array`); | ||
} | ||
target[key] = _.uniq(target[key].concat(source[key])); | ||
} | ||
else { | ||
@@ -222,0 +237,0 @@ Object.assign(target, { [key]: source[key] }); |
{ | ||
"name": "@telefonica/language-model-converter", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "Language model converter yaml <-> json for LUIS", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -298,13 +298,27 @@ /** | ||
for (const key in source) { | ||
if (isObject(source[key])) { | ||
if (!target[key]) { | ||
Object.assign(target, { [key]: {} }); | ||
if (!source[key]) { | ||
// Ignore empty values such as an intent key without examples | ||
continue; | ||
} else if (isObject(source[key])) { | ||
if (!target[key]) { | ||
Object.assign(target, { [key]: {} }); | ||
} | ||
if (!isObject(target[key])) { | ||
throw new Error(`Property ${key} already exist in target but it is not an object`); | ||
} | ||
mergeDeep(target[key], source[key]); | ||
} else if (Array.isArray(source[key])) { | ||
if (!target[key]) { | ||
Object.assign(target, { [key]: [] }); | ||
} | ||
if (!Array.isArray(target[key])) { | ||
throw new Error(`Property ${key} already exist in target but it is not an array`); | ||
} | ||
target[key] = _.uniq(target[key].concat(source[key])); | ||
} else { | ||
Object.assign(target, { [key]: source[key] }); | ||
} | ||
mergeDeep(target[key], source[key]); | ||
} else { | ||
Object.assign(target, { [key]: source[key] }); | ||
} | ||
} | ||
} | ||
return target; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
555321
21
20762
1