Comparing version 4.1.0 to 4.1.1
{ | ||
"name": "xliff", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "xliff2js and js2xliff converter xliff utils", | ||
@@ -10,6 +10,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"xml-js": "1.6.7" | ||
"xml-js": "1.6.8" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^5.6.0", | ||
"eslint": "^5.9.0", | ||
"expect.js": "^0.3.1", | ||
@@ -16,0 +16,0 @@ "mocha": "^5.0.5" |
@@ -24,36 +24,38 @@ const convert = require('xml-js'); | ||
const srcLang = xliffRoot.attributes['srcLang']; | ||
const trgLang = xliffRoot.attributes['trgLang']; | ||
if (xliffRoot.attributes) { | ||
const srcLang = xliffRoot.attributes['srcLang']; | ||
const trgLang = xliffRoot.attributes['trgLang']; | ||
result.sourceLanguage = srcLang; | ||
result.targetLanguage = trgLang; | ||
result.sourceLanguage = srcLang; | ||
result.targetLanguage = trgLang; | ||
result.resources = xliffRoot.elements.reduce((resources, file) => { | ||
const namespace = file.attributes.id; | ||
result.resources = xliffRoot.elements.reduce((resources, file) => { | ||
const namespace = file.attributes.id; | ||
// namespace | ||
resources[namespace] = file.elements.reduce((file, unit) => { | ||
const key = unit.attributes.id; | ||
// namespace | ||
resources[namespace] = file.elements.reduce((file, unit) => { | ||
const key = unit.attributes.id; | ||
// source, target, note | ||
file[key] = unit.elements.reduce((unit, segment) => { | ||
segment.elements.forEach((element) => { | ||
switch (element.name) { | ||
case 'source': | ||
case 'target': | ||
case 'note': | ||
unit[element.name] = extractValue(element.elements, ElementTypes2); | ||
break; | ||
} | ||
}); | ||
// source, target, note | ||
file[key] = unit.elements.reduce((unit, segment) => { | ||
segment.elements.forEach((element) => { | ||
switch (element.name) { | ||
case 'source': | ||
case 'target': | ||
case 'note': | ||
unit[element.name] = extractValue(element.elements, ElementTypes2); | ||
break; | ||
} | ||
}); | ||
return unit; | ||
}, { source: '', target: '' }); | ||
return unit; | ||
}, { source: '', target: '' }); | ||
return file; | ||
return file; | ||
}, {}); | ||
return resources; | ||
}, {}); | ||
} | ||
return resources; | ||
}, {}); | ||
if (cb) return cb(null, result); | ||
@@ -60,0 +62,0 @@ return result; |
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
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
90983
1411
+ Addedxml-js@1.6.8(transitive)
- Removedxml-js@1.6.7(transitive)
Updatedxml-js@1.6.8