Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xliff

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xliff - npm Package Compare versions

Comparing version 5.0.5 to 5.0.6

esm/createjs.js

4

CHANGELOG.md

@@ -0,1 +1,5 @@

### 5.0.6
- transpile also esm
### 5.0.5

@@ -2,0 +6,0 @@

4

cjs/createjs.js

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;

@@ -68,3 +68,3 @@ var createjsClb = function createjsClb(srcLng, trgLng, srcKeys, trgKeys, ns, cb) {

var _default = createjs;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = createxliff;
exports.default = createxliff;

@@ -13,6 +13,6 @@ var _createjs = _interopRequireDefault(require("./createjs.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var createjs = _createjs["default"].createjsClb;
var js2xliff = _js2xliff["default"].js2xliffClb;
var createjs = _createjs.default.createjsClb;
var js2xliff = _js2xliff.default.js2xliffClb;

@@ -19,0 +19,0 @@ var createxliffClb = function createxliffClb(srcLng, trgLng, srcKeys, trgKeys, ns, cb) {

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = createxliff12;
exports.default = createxliff12;

@@ -13,6 +13,6 @@ var _createjs = _interopRequireDefault(require("./createjs.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var createjs = _createjs["default"].createjsClb;
var jsToXliff12 = _jsToXliff["default"].jsToXliff12Clb;
var createjs = _createjs.default.createjsClb;
var jsToXliff12 = _jsToXliff.default.jsToXliff12Clb;

@@ -19,0 +19,0 @@ var createxliff12Clb = function createxliff12Clb(srcLng, trgLng, srcKeys, trgKeys, ns, cb) {

@@ -9,3 +9,3 @@ "use strict";

get: function get() {
return _xliff2js["default"];
return _xliff2js.default;
}

@@ -16,3 +16,3 @@ });

get: function get() {
return _xliff12ToJs["default"];
return _xliff12ToJs.default;
}

@@ -23,3 +23,3 @@ });

get: function get() {
return _js2xliff["default"];
return _js2xliff.default;
}

@@ -30,3 +30,3 @@ });

get: function get() {
return _jsToXliff["default"];
return _jsToXliff.default;
}

@@ -37,3 +37,3 @@ });

get: function get() {
return _targetOfjs["default"];
return _targetOfjs.default;
}

@@ -44,3 +44,3 @@ });

get: function get() {
return _sourceOfjs["default"];
return _sourceOfjs.default;
}

@@ -51,3 +51,3 @@ });

get: function get() {
return _createjs["default"];
return _createjs.default;
}

@@ -58,3 +58,3 @@ });

get: function get() {
return _createxliff["default"];
return _createxliff.default;
}

@@ -65,6 +65,6 @@ });

get: function get() {
return _createxliff2["default"];
return _createxliff2.default;
}
});
exports["default"] = void 0;
exports.default = void 0;

@@ -89,15 +89,15 @@ var _xliff2js = _interopRequireDefault(require("./xliff2js.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = {
xliff2js: _xliff2js["default"],
xliff12ToJs: _xliff12ToJs["default"],
js2xliff: _js2xliff["default"],
jsToXliff12: _jsToXliff["default"],
targetOfjs: _targetOfjs["default"],
sourceOfjs: _sourceOfjs["default"],
createjs: _createjs["default"],
createxliff: _createxliff["default"],
createxliff12: _createxliff2["default"]
xliff2js: _xliff2js.default,
xliff12ToJs: _xliff12ToJs.default,
js2xliff: _js2xliff.default,
jsToXliff12: _jsToXliff.default,
targetOfjs: _targetOfjs.default,
sourceOfjs: _sourceOfjs.default,
createjs: _createjs.default,
createxliff: _createxliff.default,
createxliff12: _createxliff2.default
};
exports["default"] = _default;
exports.default = _default;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;
var _default = {

@@ -17,3 +17,3 @@ Standalone: 'Standalone',

};
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;

@@ -15,3 +15,3 @@ var _ElementTypes = _interopRequireDefault(require("./ElementTypes.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -21,29 +21,29 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var _default = {
elementTypeToTagMap: (_elementTypeToTagMap = {}, _defineProperty(_elementTypeToTagMap, _ElementTypes["default"].Standalone, 'x'), _defineProperty(_elementTypeToTagMap, _ElementTypes["default"].GenericSpan, 'g'), _defineProperty(_elementTypeToTagMap, _ElementTypes["default"].GenericSpanStart, 'bx'), _defineProperty(_elementTypeToTagMap, _ElementTypes["default"].GenericSpanEnd, 'ex'), _defineProperty(_elementTypeToTagMap, _ElementTypes["default"].Span, 'ph'), _defineProperty(_elementTypeToTagMap, _ElementTypes["default"].SpanStart, 'bpt'), _defineProperty(_elementTypeToTagMap, _ElementTypes["default"].SpanEnd, 'ept'), _elementTypeToTagMap),
elementTypeToTagMap: (_elementTypeToTagMap = {}, _defineProperty(_elementTypeToTagMap, _ElementTypes.default.Standalone, 'x'), _defineProperty(_elementTypeToTagMap, _ElementTypes.default.GenericSpan, 'g'), _defineProperty(_elementTypeToTagMap, _ElementTypes.default.GenericSpanStart, 'bx'), _defineProperty(_elementTypeToTagMap, _ElementTypes.default.GenericSpanEnd, 'ex'), _defineProperty(_elementTypeToTagMap, _ElementTypes.default.Span, 'ph'), _defineProperty(_elementTypeToTagMap, _ElementTypes.default.SpanStart, 'bpt'), _defineProperty(_elementTypeToTagMap, _ElementTypes.default.SpanEnd, 'ept'), _elementTypeToTagMap),
tagToElementTypeMap: {
x: _ElementTypes["default"].Standalone,
g: _ElementTypes["default"].GenericSpan,
bx: _ElementTypes["default"].GenericSpanStart,
ex: _ElementTypes["default"].GenericSpanEnd,
ph: _ElementTypes["default"].Span,
bpt: _ElementTypes["default"].SpanStart,
ept: _ElementTypes["default"].SpanEnd
x: _ElementTypes.default.Standalone,
g: _ElementTypes.default.GenericSpan,
bx: _ElementTypes.default.GenericSpanStart,
ex: _ElementTypes.default.GenericSpanEnd,
ph: _ElementTypes.default.Span,
bpt: _ElementTypes.default.SpanStart,
ept: _ElementTypes.default.SpanEnd
},
factories: (_factories = {}, _defineProperty(_factories, _ElementTypes["default"].Standalone, function (type, id, attributes) {
return (0, _makeInlineElement["default"])(_ElementTypes["default"].Standalone, id, attributes);
}), _defineProperty(_factories, _ElementTypes["default"].GenericSpan, function (type, id, attributes, contents) {
return (0, _makeInlineElement["default"])(_ElementTypes["default"].GenericSpan, id, attributes, contents);
}), _defineProperty(_factories, _ElementTypes["default"].GenericSpanStart, function (type, id, attributes) {
return (0, _makeInlineElement["default"])(_ElementTypes["default"].GenericSpanStart, id, attributes);
}), _defineProperty(_factories, _ElementTypes["default"].GenericSpanEnd, function (type, id, attributes) {
return (0, _makeInlineElement["default"])(_ElementTypes["default"].GenericSpanEnd, id, attributes);
}), _defineProperty(_factories, _ElementTypes["default"].Span, function (type, id, attributes, contents) {
return (0, _makeInlineElement["default"])(_ElementTypes["default"].Span, id, attributes, contents);
}), _defineProperty(_factories, _ElementTypes["default"].SpanStart, function (type, id, attributes, contents) {
return (0, _makeInlineElement["default"])(_ElementTypes["default"].SpanStart, id, attributes, contents);
}), _defineProperty(_factories, _ElementTypes["default"].SpanEnd, function (type, id, attributes, contents) {
return (0, _makeInlineElement["default"])(_ElementTypes["default"].SpanEnd, id, attributes, contents);
factories: (_factories = {}, _defineProperty(_factories, _ElementTypes.default.Standalone, function (type, id, attributes) {
return (0, _makeInlineElement.default)(_ElementTypes.default.Standalone, id, attributes);
}), _defineProperty(_factories, _ElementTypes.default.GenericSpan, function (type, id, attributes, contents) {
return (0, _makeInlineElement.default)(_ElementTypes.default.GenericSpan, id, attributes, contents);
}), _defineProperty(_factories, _ElementTypes.default.GenericSpanStart, function (type, id, attributes) {
return (0, _makeInlineElement.default)(_ElementTypes.default.GenericSpanStart, id, attributes);
}), _defineProperty(_factories, _ElementTypes.default.GenericSpanEnd, function (type, id, attributes) {
return (0, _makeInlineElement.default)(_ElementTypes.default.GenericSpanEnd, id, attributes);
}), _defineProperty(_factories, _ElementTypes.default.Span, function (type, id, attributes, contents) {
return (0, _makeInlineElement.default)(_ElementTypes.default.Span, id, attributes, contents);
}), _defineProperty(_factories, _ElementTypes.default.SpanStart, function (type, id, attributes, contents) {
return (0, _makeInlineElement.default)(_ElementTypes.default.SpanStart, id, attributes, contents);
}), _defineProperty(_factories, _ElementTypes.default.SpanEnd, function (type, id, attributes, contents) {
return (0, _makeInlineElement.default)(_ElementTypes.default.SpanEnd, id, attributes, contents);
}), _factories)
};
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;

@@ -15,3 +15,3 @@ var _ElementTypes = _interopRequireDefault(require("./ElementTypes.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -21,26 +21,26 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var _default = {
elementTypeToTagMap: (_elementTypeToTagMap = {}, _defineProperty(_elementTypeToTagMap, _ElementTypes["default"].Standalone, 'ph'), _defineProperty(_elementTypeToTagMap, _ElementTypes["default"].GenericSpan, 'pc'), _defineProperty(_elementTypeToTagMap, _ElementTypes["default"].GenericSpanStart, 'sc'), _defineProperty(_elementTypeToTagMap, _ElementTypes["default"].GenericSpanEnd, 'ec'), _defineProperty(_elementTypeToTagMap, _ElementTypes["default"].Span, 'pc'), _defineProperty(_elementTypeToTagMap, _ElementTypes["default"].SpanStart, 'sc'), _defineProperty(_elementTypeToTagMap, _ElementTypes["default"].SpanEnd, 'ec'), _elementTypeToTagMap),
elementTypeToTagMap: (_elementTypeToTagMap = {}, _defineProperty(_elementTypeToTagMap, _ElementTypes.default.Standalone, 'ph'), _defineProperty(_elementTypeToTagMap, _ElementTypes.default.GenericSpan, 'pc'), _defineProperty(_elementTypeToTagMap, _ElementTypes.default.GenericSpanStart, 'sc'), _defineProperty(_elementTypeToTagMap, _ElementTypes.default.GenericSpanEnd, 'ec'), _defineProperty(_elementTypeToTagMap, _ElementTypes.default.Span, 'pc'), _defineProperty(_elementTypeToTagMap, _ElementTypes.default.SpanStart, 'sc'), _defineProperty(_elementTypeToTagMap, _ElementTypes.default.SpanEnd, 'ec'), _elementTypeToTagMap),
tagToElementTypeMap: {
ph: _ElementTypes["default"].Standalone,
pc: _ElementTypes["default"].Span,
sc: _ElementTypes["default"].SpanStart,
ec: _ElementTypes["default"].SpanEnd
ph: _ElementTypes.default.Standalone,
pc: _ElementTypes.default.Span,
sc: _ElementTypes.default.SpanStart,
ec: _ElementTypes.default.SpanEnd
},
factories: (_factories = {}, _defineProperty(_factories, _ElementTypes["default"].Standalone, function (type, id, attributes) {
return (0, _makeInlineElement["default"])(_ElementTypes["default"].Standalone, id, attributes);
}), _defineProperty(_factories, _ElementTypes["default"].GenericSpan, function (type, id, attributes, contents) {
return (0, _makeInlineElement["default"])(_ElementTypes["default"].GenericSpan, id, attributes, contents);
}), _defineProperty(_factories, _ElementTypes["default"].GenericSpanStart, function (type, id, attributes) {
return (0, _makeInlineElement["default"])(_ElementTypes["default"].GenericSpanStart, id, attributes);
}), _defineProperty(_factories, _ElementTypes["default"].GenericSpanEnd, function (type, id, attributes) {
return (0, _makeInlineElement["default"])(_ElementTypes["default"].GenericSpanEnd, id, attributes);
}), _defineProperty(_factories, _ElementTypes["default"].Span, function (type, id, attributes, contents) {
return (0, _makeInlineElement["default"])(_ElementTypes["default"].Span, id, attributes, contents);
}), _defineProperty(_factories, _ElementTypes["default"].SpanStart, function (type, id, attributes, contents) {
return (0, _makeInlineElement["default"])(_ElementTypes["default"].SpanStart, id, attributes, contents);
}), _defineProperty(_factories, _ElementTypes["default"].SpanEnd, function (type, id, attributes, contents) {
return (0, _makeInlineElement["default"])(_ElementTypes["default"].SpanEnd, id, attributes, contents);
factories: (_factories = {}, _defineProperty(_factories, _ElementTypes.default.Standalone, function (type, id, attributes) {
return (0, _makeInlineElement.default)(_ElementTypes.default.Standalone, id, attributes);
}), _defineProperty(_factories, _ElementTypes.default.GenericSpan, function (type, id, attributes, contents) {
return (0, _makeInlineElement.default)(_ElementTypes.default.GenericSpan, id, attributes, contents);
}), _defineProperty(_factories, _ElementTypes.default.GenericSpanStart, function (type, id, attributes) {
return (0, _makeInlineElement.default)(_ElementTypes.default.GenericSpanStart, id, attributes);
}), _defineProperty(_factories, _ElementTypes.default.GenericSpanEnd, function (type, id, attributes) {
return (0, _makeInlineElement.default)(_ElementTypes.default.GenericSpanEnd, id, attributes);
}), _defineProperty(_factories, _ElementTypes.default.Span, function (type, id, attributes, contents) {
return (0, _makeInlineElement.default)(_ElementTypes.default.Span, id, attributes, contents);
}), _defineProperty(_factories, _ElementTypes.default.SpanStart, function (type, id, attributes, contents) {
return (0, _makeInlineElement.default)(_ElementTypes.default.SpanStart, id, attributes, contents);
}), _defineProperty(_factories, _ElementTypes.default.SpanEnd, function (type, id, attributes, contents) {
return (0, _makeInlineElement.default)(_ElementTypes.default.SpanEnd, id, attributes, contents);
}), _factories)
};
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;

@@ -6,15 +6,6 @@ "use strict";

});
exports["default"] = makeInlineElement;
exports.default = makeInlineElement;
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/**
* Helper to construct an object representing an XLIFF inline element (an XML element within a `source` or `target` value).
* @param type The inline element type. This should be one of the constants defined in ElementTypes.js
* @param id The element's id
* @param attributes (optional) An object with property/value pairs that correspond to the attributes to add to the element.
* @param contents (optional) A string or Array containing the contents to be inserted between the opening and closing tags
* (if the element is a type that supports contents).
* @return An object in the proper structure to represent the XLIFF inline element as supported by this library
*/
function makeInlineElement(type, id, attributes, contents) {

@@ -21,0 +12,0 @@ var contentsObj = contents !== undefined ? {

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;

@@ -17,3 +17,3 @@ var _xmlJs = _interopRequireDefault(require("xml-js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -48,4 +48,4 @@ var js2xliffClb = function js2xliffClb(obj, opt, cb) {

var segment = (0, _objectToXml.makeElement)('segment', null, true);
segment.elements.push((0, _objectToXml.makeElement)('source', null, (0, _objectToXml.makeValue)(obj.resources[nsName][k].source, _ElementTypes["default"])));
segment.elements.push((0, _objectToXml.makeElement)('target', null, (0, _objectToXml.makeValue)(obj.resources[nsName][k].target, _ElementTypes["default"])));
segment.elements.push((0, _objectToXml.makeElement)('source', null, (0, _objectToXml.makeValue)(obj.resources[nsName][k].source, _ElementTypes.default)));
segment.elements.push((0, _objectToXml.makeElement)('target', null, (0, _objectToXml.makeValue)(obj.resources[nsName][k].target, _ElementTypes.default)));

@@ -58,3 +58,3 @@ if ('note' in obj.resources[nsName][k]) {

var u = (0, _objectToXml.makeElement)('unit', Object.assign({
id: (0, _escape["default"])(k)
id: (0, _escape.default)(k)
}, additionalAttributes), [segment]);

@@ -68,3 +68,3 @@ f.elements.push(u);

var xml = _xmlJs["default"].js2xml(xmlJs, options);
var xml = _xmlJs.default.js2xml(xmlJs, options);

@@ -97,3 +97,3 @@ if (cb) cb(null, xml);

var _default = js2xliff;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports.default = void 0;

@@ -17,3 +17,3 @@ var _xmlJs = _interopRequireDefault(require("xml-js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -68,3 +68,3 @@ var jsToXliff12Clb = function jsToXliff12Clb(obj, opt, cb) {

var xml = _xmlJs["default"].js2xml(xmlJs, options);
var xml = _xmlJs.default.js2xml(xmlJs, options);

@@ -78,3 +78,3 @@ if (cb) cb(null, xml);

var u = (0, _objectToXml.makeElement)('group', Object.assign({
id: (0, _escape["default"])(key)
id: (0, _escape.default)(key)
}, additionalAttributes), true);

@@ -90,3 +90,3 @@ Object.keys(resource.groupUnits).forEach(function (transUnitKey) {

var u = (0, _objectToXml.makeElement)('trans-unit', Object.assign({
id: (0, _escape["default"])(key)
id: (0, _escape.default)(key)
}, additionalAttributes), true);

@@ -101,3 +101,3 @@ var sourceAttributes = null;

u.elements.push((0, _objectToXml.makeElement)('source', sourceAttributes, (0, _objectToXml.makeValue)(resource.source, _ElementTypes["default"])));
u.elements.push((0, _objectToXml.makeElement)('source', sourceAttributes, (0, _objectToXml.makeValue)(resource.source, _ElementTypes.default)));

@@ -113,3 +113,3 @@ if (resource.target != null) {

u.elements.push((0, _objectToXml.makeElement)('target', targetAttributes, (0, _objectToXml.makeValue)(resource.target, _ElementTypes["default"])));
u.elements.push((0, _objectToXml.makeElement)('target', targetAttributes, (0, _objectToXml.makeValue)(resource.target, _ElementTypes.default)));
}

@@ -146,3 +146,3 @@

var _default = jsToXliff12;
exports["default"] = _default;
exports.default = _default;
module.exports = exports.default;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = ofjs;
exports.default = ofjs;

@@ -9,0 +9,0 @@ function ofjs(js, what, cb) {

@@ -6,12 +6,12 @@ "use strict";

});
exports["default"] = sourceOfjs;
exports.default = sourceOfjs;
var _ofjs = _interopRequireDefault(require("./ofjs.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function sourceOfjs(js, cb) {
return (0, _ofjs["default"])(js, 'source', cb);
return (0, _ofjs.default)(js, 'source', cb);
}
module.exports = exports.default;

@@ -6,12 +6,12 @@ "use strict";

});
exports["default"] = targetOfjs;
exports.default = targetOfjs;
var _ofjs = _interopRequireDefault(require("./ofjs.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function targetOfjs(js, cb) {
return (0, _ofjs["default"])(js, 'target', cb);
return (0, _ofjs.default)(js, 'target', cb);
}
module.exports = exports.default;

@@ -6,6 +6,5 @@ "use strict";

});
exports["default"] = _default;
exports.default = _default;
var map = {
'&': '&',
// this must be the first !!!
'"': '"',

@@ -18,4 +17,4 @@ '\'': ''',

function _default(str) {
Object.keys(map).forEach(function (_char) {
str = str.replace(new RegExp(_char, 'g'), map[_char]);
Object.keys(map).forEach(function (char) {
str = str.replace(new RegExp(char, 'g'), map[char]);
});

@@ -22,0 +21,0 @@ return str;

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = xliff12ToJs;
exports.default = xliff12ToJs;

@@ -15,3 +15,3 @@ var _xmlJs = _interopRequireDefault(require("xml-js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -36,3 +36,3 @@ var xliff12ToJsClb = function xliff12ToJsClb(str, options, cb) {

try {
xmlObj = _xmlJs["default"].xml2js(str, {});
xmlObj = _xmlJs.default.xml2js(str, {});
} catch (err) {

@@ -59,4 +59,3 @@ if (cb) return cb(err);

return transunit.type !== 'comment';
}); // namespace
});
resources[namespace] = transUnits.reduce(function (file, transUnit) {

@@ -88,3 +87,3 @@ var key = transUnit.attributes.id;

case 'note':
unit[element.name] = (0, _xmlToObject.extractValue)(element.elements, _ElementTypes["default"]);
unit[element.name] = (0, _xmlToObject.extractValue)(element.elements, _ElementTypes.default);
break;

@@ -91,0 +90,0 @@ }

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = xliffToJs;
exports.default = xliffToJs;

@@ -15,3 +15,3 @@ var _xmlJs = _interopRequireDefault(require("xml-js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -36,3 +36,3 @@ var xliffToJsClb = function xliffToJsClb(str, options, cb) {

try {
xmlObj = _xmlJs["default"].xml2js(str, {});
xmlObj = _xmlJs.default.xml2js(str, {});
} catch (err) {

@@ -59,9 +59,7 @@ if (cb) return cb(err);

};
if (!result.targetLanguage) delete initValues.target; // namespace
if (!result.targetLanguage) delete initValues.target;
file.elements = file.elements || [];
resources[namespace] = file.elements.reduce(function (file, unit) {
if (unit.name !== 'unit') return file;
var key = unit.attributes.id; // source, target, note
var key = unit.attributes.id;
file[key] = unit.elements.reduce(function (unit, segment) {

@@ -73,3 +71,3 @@ segment.elements.forEach(function (element) {

case 'note':
unit[element.name] = (0, _xmlToObject.extractValue)(element.elements, _ElementTypes["default"]);
unit[element.name] = (0, _xmlToObject.extractValue)(element.elements, _ElementTypes.default);
break;

@@ -76,0 +74,0 @@ }

@@ -46,6 +46,4 @@ "use strict";

return makeText(segment);
} // Inline elements
// Each inline element object should only have one property (key) -- the element type
}
var elementType = Object.keys(segment)[0];

@@ -57,4 +55,3 @@ var elementTag = (0, _typeToTagMaps.elementTypeToTag)(elementType, elementTypeInfo);

delete attrsSrc.id;
delete attrsSrc.contents; // eslint-disable-next-line no-prototype-builtins
delete attrsSrc.contents;
var contents = segment[elementType].hasOwnProperty('contents') ? makeValue(segment[elementType].contents, elementTypeInfo) : undefined;

@@ -68,6 +65,4 @@ var attrs = {

return makeElement(elementTag, attrs, contents);
} // If an invalid object is included as a segment in a source/target value array,
// just turn it into an XML comment
}
var segmentString = '{ ' + Object.keys(segment).reduce(function (result, segmentKey) {

@@ -74,0 +69,0 @@ return result + segmentKey + ': "' + segment[segmentKey].toString() + '"';

@@ -21,3 +21,3 @@ "use strict";

var valueElement = Array.isArray(valueElements) ? valueElements[0] || '' : valueElements; // text node
var valueElement = Array.isArray(valueElements) ? valueElements[0] || '' : valueElements;

@@ -30,5 +30,4 @@ if (valueElement.type === 'text') {

return valueElement.text;
} // nested inline element tag
}
var elementType = (0, _typeToTagMaps.tagToElementType)(valueElement.name, elementTypeInfo);

@@ -39,6 +38,5 @@

return inlineElementFactory(valueElement.name, valueElement.attributes.id, valueElement.attributes, extractValue(valueElement.elements, elementTypeInfo));
} // just ignore anything else
}
return '';
}
{
"name": "xliff",
"version": "5.0.5",
"version": "5.0.6",
"description": "xliff2js and js2xliff converter xliff utils",

@@ -8,45 +8,46 @@ "type": "module",

"exports": {
"./package.json": "./package.json",
".": {
"require": "./cjs/index.js",
"default": "./lib/index.js"
"default": "./esm/index.js"
},
"./createjs": {
"require": "./cjs/createjs.js",
"default": "./lib/createjs.js"
"default": "./esm/createjs.js"
},
"./createxliff": {
"require": "./cjs/createxliff.js",
"default": "./lib/createxliff.js"
"default": "./esm/createxliff.js"
},
"./createxliff12": {
"require": "./cjs/createxliff12.js",
"default": "./lib/createxliff12.js"
"default": "./esm/createxliff12.js"
},
"./js2xliff": {
"require": "./cjs/js2xliff.js",
"default": "./lib/js2xliff.js"
"default": "./esm/js2xliff.js"
},
"./jsToXliff12": {
"require": "./cjs/jsToXliff12.js",
"default": "./lib/jsToXliff12.js"
"default": "./esm/jsToXliff12.js"
},
"./ofjs": {
"require": "./cjs/ofjs.js",
"default": "./lib/ofjs.js"
"default": "./esm/ofjs.js"
},
"./sourceOfjs": {
"require": "./cjs/sourceOfjs.js",
"default": "./lib/sourceOfjs.js"
"default": "./esm/sourceOfjs.js"
},
"./targetOfjs": {
"require": "./cjs/targetOfjs.js",
"default": "./lib/targetOfjs.js"
"default": "./esm/targetOfjs.js"
},
"./xliff2js": {
"require": "./cjs/xliff2js.js",
"default": "./lib/xliff2js.js"
"default": "./esm/xliff2js.js"
},
"./xliff12ToJs": {
"require": "./cjs/xliff12ToJs.js",
"default": "./lib/xliff12ToJs.js"
"default": "./esm/xliff12ToJs.js"
},

@@ -85,5 +86,38 @@ "./cjs": {

"default": "./cjs/xliff12ToJs.js"
},
"./esm": {
"default": "./esm/index.js"
},
"./esm/createjs": {
"default": "./esm/createjs.js"
},
"./esm/createxliff": {
"default": "./esm/createxliff.js"
},
"./esm/createxliff12": {
"default": "./esm/createxliff12.js"
},
"./esm/js2xliff": {
"default": "./esm/js2xliff.js"
},
"./esm/jsToXliff12": {
"default": "./esm/jsToXliff12.js"
},
"./esm/ofjs": {
"default": "./esm/ofjs.js"
},
"./esm/sourceOfjs": {
"default": "./esm/sourceOfjs.js"
},
"./esm/targetOfjs": {
"default": "./esm/targetOfjs.js"
},
"./esm/xliff2js": {
"default": "./esm/xliff2js.js"
},
"./esm/xliff12ToJs": {
"default": "./esm/xliff12ToJs.js"
}
},
"module": "./lib/index.js",
"module": "./esm/index.js",
"dependencies": {

@@ -93,10 +127,10 @@ "xml-js": "1.6.11"

"devDependencies": {
"@babel/cli": "7.8.4",
"@babel/core": "7.9.0",
"@babel/preset-env": "7.9.5",
"@babel/cli": "7.10.4",
"@babel/core": "7.10.4",
"@babel/preset-env": "7.10.4",
"babel-plugin-add-module-exports": "1.0.2",
"browserify": "16.5.1",
"eslint": "6.8.0",
"eslint": "7.3.1",
"eslint-config-standard": "14.1.1",
"eslint-plugin-import": "2.20.2",
"eslint-plugin-import": "2.22.0",
"eslint-plugin-node": "11.1.0",

@@ -107,8 +141,10 @@ "eslint-plugin-promise": "4.2.1",

"expect.js": "0.3.1",
"mocha": "7.1.1",
"uglify-js": "3.9.1"
"mocha": "8.0.1",
"uglify-js": "3.10.0"
},
"scripts": {
"lint": "eslint .",
"compile": "rm -rf cjs && mkdir cjs && babel lib -d cjs --presets=@babel/preset-env --plugins=add-module-exports && echo '{\"type\":\"commonjs\"}' > cjs/package.json",
"compile:esm": "rm -rf esm && mkdir esm && BABEL_ENV=esm babel lib -d esm",
"compile:cjs": "rm -rf cjs && mkdir cjs && BABEL_ENV=cjs babel lib -d cjs && echo '{\"type\":\"commonjs\"}' > cjs/package.json",
"compile": "npm run compile:esm && npm run compile:cjs",
"browser": "browserify --standalone xliff cjs/index.js -o xliff.js && uglifyjs xliff.js --compress --mangle -o xliff.min.js",

@@ -115,0 +151,0 @@ "build": "npm run compile && npm run browser",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc