Comparing version 6.0.0 to 6.0.1
@@ -43,19 +43,25 @@ "use strict"; | ||
}); | ||
var srcLang = xliffRoot.elements[0].attributes['source-language']; | ||
var trgLang = xliffRoot.elements[0].attributes['target-language']; | ||
result.sourceLanguage = srcLang; | ||
result.targetLanguage = trgLang; | ||
if (!result.targetLanguage) delete result.targetLanguage; | ||
result.resources = xliffRoot.elements.reduce(function (resources, file) { | ||
var namespace = options.namespace || file.attributes.original; | ||
var body = file.elements.find(function (e) { | ||
return e.name === 'body'; | ||
}); | ||
body.elements = body.elements || []; | ||
var bodyChildren = body.elements.filter(function (child) { | ||
return child.type !== 'comment'; | ||
}); | ||
resources[namespace] = createUnits(bodyChildren); | ||
return resources; | ||
}, {}); | ||
if (xliffRoot.elements && xliffRoot.elements.length) { | ||
var srcLang = xliffRoot.elements[0].attributes['source-language']; | ||
var trgLang = xliffRoot.elements[0].attributes['target-language']; | ||
result.sourceLanguage = srcLang; | ||
result.targetLanguage = trgLang; | ||
if (!result.targetLanguage) delete result.targetLanguage; | ||
result.resources = xliffRoot.elements.reduce(function (resources, file) { | ||
var namespace = options.namespace || file.attributes.original; | ||
var body = file.elements.find(function (e) { | ||
return e.name === 'body'; | ||
}); | ||
body.elements = body.elements || []; | ||
var bodyChildren = body.elements.filter(function (child) { | ||
return child.type !== 'comment'; | ||
}); | ||
resources[namespace] = createUnits(bodyChildren); | ||
return resources; | ||
}, {}); | ||
} else { | ||
result.resources = {}; | ||
} | ||
if (cb) return cb(null, result); | ||
@@ -62,0 +68,0 @@ return result; |
@@ -32,19 +32,25 @@ import convert from 'xml-js'; | ||
}); | ||
var srcLang = xliffRoot.elements[0].attributes['source-language']; | ||
var trgLang = xliffRoot.elements[0].attributes['target-language']; | ||
result.sourceLanguage = srcLang; | ||
result.targetLanguage = trgLang; | ||
if (!result.targetLanguage) delete result.targetLanguage; | ||
result.resources = xliffRoot.elements.reduce(function (resources, file) { | ||
var namespace = options.namespace || file.attributes.original; | ||
var body = file.elements.find(function (e) { | ||
return e.name === 'body'; | ||
}); | ||
body.elements = body.elements || []; | ||
var bodyChildren = body.elements.filter(function (child) { | ||
return child.type !== 'comment'; | ||
}); | ||
resources[namespace] = createUnits(bodyChildren); | ||
return resources; | ||
}, {}); | ||
if (xliffRoot.elements && xliffRoot.elements.length) { | ||
var srcLang = xliffRoot.elements[0].attributes['source-language']; | ||
var trgLang = xliffRoot.elements[0].attributes['target-language']; | ||
result.sourceLanguage = srcLang; | ||
result.targetLanguage = trgLang; | ||
if (!result.targetLanguage) delete result.targetLanguage; | ||
result.resources = xliffRoot.elements.reduce(function (resources, file) { | ||
var namespace = options.namespace || file.attributes.original; | ||
var body = file.elements.find(function (e) { | ||
return e.name === 'body'; | ||
}); | ||
body.elements = body.elements || []; | ||
var bodyChildren = body.elements.filter(function (child) { | ||
return child.type !== 'comment'; | ||
}); | ||
resources[namespace] = createUnits(bodyChildren); | ||
return resources; | ||
}, {}); | ||
} else { | ||
result.resources = {}; | ||
} | ||
if (cb) return cb(null, result); | ||
@@ -51,0 +57,0 @@ return result; |
@@ -29,23 +29,27 @@ import convert from 'xml-js' | ||
const srcLang = xliffRoot.elements[0].attributes['source-language'] | ||
const trgLang = xliffRoot.elements[0].attributes['target-language'] | ||
if (xliffRoot.elements && xliffRoot.elements.length) { | ||
const srcLang = xliffRoot.elements[0].attributes['source-language'] | ||
const trgLang = xliffRoot.elements[0].attributes['target-language'] | ||
result.sourceLanguage = srcLang | ||
result.targetLanguage = trgLang | ||
if (!result.targetLanguage) delete result.targetLanguage | ||
result.sourceLanguage = srcLang | ||
result.targetLanguage = trgLang | ||
if (!result.targetLanguage) delete result.targetLanguage | ||
result.resources = xliffRoot.elements.reduce((resources, file) => { | ||
const namespace = options.namespace || file.attributes.original | ||
result.resources = xliffRoot.elements.reduce((resources, file) => { | ||
const namespace = options.namespace || file.attributes.original | ||
const body = file.elements.find((e) => e.name === 'body') | ||
body.elements = body.elements || [] | ||
const bodyChildren = body.elements.filter( | ||
(child) => child.type !== 'comment' | ||
) | ||
const body = file.elements.find((e) => e.name === 'body') | ||
body.elements = body.elements || [] | ||
const bodyChildren = body.elements.filter( | ||
(child) => child.type !== 'comment' | ||
) | ||
// namespace | ||
resources[namespace] = createUnits(bodyChildren) | ||
// namespace | ||
resources[namespace] = createUnits(bodyChildren) | ||
return resources | ||
}, {}) | ||
return resources | ||
}, {}) | ||
} else { | ||
result.resources = {} | ||
} | ||
@@ -52,0 +56,0 @@ if (cb) return cb(null, result) |
{ | ||
"name": "xliff", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "xliff2js and js2xliff converter xliff utils", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
557480
11343