Socket
Socket
Sign inDemoInstall

mjml-parser-xml

Package Overview
Dependencies
Maintainers
4
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mjml-parser-xml - npm Package Compare versions

Comparing version 4.0.0-alpha.3 to 4.0.0-alpha.4

7

lib/helpers/cleanNode.js

@@ -6,2 +6,7 @@ 'use strict';

});
var _keys = require('babel-runtime/core-js/object/keys');
var _keys2 = _interopRequireDefault(_keys);
exports.default = cleanNode;

@@ -26,3 +31,3 @@

// Delete attributes if needed
if (node.attributes && Object.keys(node.attributes).length === 0) {
if (node.attributes && (0, _keys2.default)(node.attributes).length === 0) {
delete node.attributes;

@@ -29,0 +34,0 @@ }

4

lib/helpers/parseAttributes.js

@@ -8,4 +8,4 @@ 'use strict';

exports.decodeAttributes = decodeAttributes;
var regexTag = /<([^>])*>/gmi;
var regexAttributes = /([^\s]*="|')([^"|']*)("|')/gmi;
var regexTag = /<([^>])*>/gim;
var regexAttributes = /([^\s]*="|')([^"|']*)("|')/gim;

@@ -12,0 +12,0 @@ function parseAttributes(input) {

@@ -7,4 +7,10 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
exports.default = MJMLParser;

@@ -74,4 +80,2 @@

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var indexesForNewLine = function indexesForNewLine(xml) {

@@ -106,3 +110,3 @@ var regex = /\n/gi;

return component.getTagName();
}))(_extends({}, components));
}))((0, _extends3.default)({}, components));

@@ -137,3 +141,3 @@ var cwd = filePath ? _path2.default.dirname(filePath) : process.cwd();

tagName: 'mj-raw',
content: '<!-- mj-include fails with file : ' + file + ' at ' + partialPath + ' -->',
content: '<!-- mj-include fails to read file : ' + file + ' at ' + partialPath + ' -->',
children: []

@@ -148,13 +152,15 @@ };

content = content.indexOf('<mjml>') == -1 ? '<mjml><mj-body>' + content + '</mj-body></mjml>' : content;
content = content.indexOf('<mjml>') === -1 ? '<mjml><mj-body>' + content + '</mj-body></mjml>' : content;
var partialMjml = parseXML(content, _extends({}, options, { filePath: partialPath }));
var partialMjml = MJMLParser(content, (0, _extends3.default)({}, options, {
filePath: partialPath
}));
var bindToTree = function bindToTree(children) {
var tree = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : cur;
return children.map(function (c) {
return _extends({}, c, { parent: tree });
return (0, _extends3.default)({}, c, { parent: tree });
});
};
if (partialMjml.tagName != 'mjml') {
if (partialMjml.tagName !== 'mjml') {
return;

@@ -167,3 +173,3 @@ }

if (body) {
cur.children = [].concat(_toConsumableArray(cur.children), _toConsumableArray(bindToTree(body.children)));
cur.children = [].concat((0, _toConsumableArray3.default)(cur.children), (0, _toConsumableArray3.default)(bindToTree(body.children)));
}

@@ -186,3 +192,3 @@

curHead.children = [].concat(_toConsumableArray(curHead.children), _toConsumableArray(bindToTree(head.children, curHead)));
curHead.children = [].concat((0, _toConsumableArray3.default)(curHead.children), (0, _toConsumableArray3.default)(bindToTree(head.children, curHead)));
}

@@ -193,2 +199,3 @@ };

onopentag: function onopentag(name, attrs) {
// eslint-disable-line consistent-return
var line = (0, _findLastIndex2.default)(lineIndexes, function (i) {

@@ -198,3 +205,3 @@ return i <= parser.startIndex;

if (name == 'mj-include') {
if (name === 'mj-include') {
inInclude = true;

@@ -201,0 +208,0 @@

{
"name": "mjml-parser-xml",
"description": "mjml-parser-xml",
"version": "4.0.0-alpha.3",
"version": "4.0.0-alpha.4",
"main": "lib/index.js",

@@ -6,0 +6,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

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