mjml-validator
Advanced tools
Comparing version 4.0.0-alpha.3 to 4.0.0-alpha.4
@@ -8,2 +8,6 @@ 'use strict'; | ||
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray'); | ||
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); | ||
var _dependencies2 = require('./dependencies'); | ||
@@ -19,18 +23,4 @@ | ||
var _concat = require('lodash/concat'); | ||
var _lodash = require('lodash'); | ||
var _concat2 = _interopRequireDefault(_concat); | ||
var _filter = require('lodash/filter'); | ||
var _filter2 = _interopRequireDefault(_filter); | ||
var _includes = require('lodash/includes'); | ||
var _includes2 = _interopRequireDefault(_includes); | ||
var _values = require('lodash/values'); | ||
var _values2 = _interopRequireDefault(_values); | ||
var _ruleError = require('./rules/ruleError'); | ||
@@ -48,4 +38,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 SKIP_ELEMENTS = ['mjml', 'mj-body', 'mj-head']; | ||
@@ -66,4 +54,4 @@ | ||
if (!(0, _includes2.default)(SKIP_ELEMENTS, tagName)) { | ||
errors = _concat2.default.apply(undefined, [errors].concat(_toConsumableArray((0, _values2.default)(_MJMLRulesCollection2.default).map(function (rule) { | ||
if (!(0, _lodash.includes)(SKIP_ELEMENTS, tagName)) { | ||
errors = _lodash.concat.apply(undefined, [errors].concat((0, _toConsumableArray3.default)((0, _lodash.values)(_MJMLRulesCollection2.default).map(function (rule) { | ||
return rule(element, options); | ||
@@ -74,3 +62,3 @@ })))); | ||
if (children && children.length > 0) { | ||
errors = _concat2.default.apply(undefined, [errors].concat(_toConsumableArray(children.map(function (child) { | ||
errors = _lodash.concat.apply(undefined, [errors].concat((0, _toConsumableArray3.default)(children.map(function (child) { | ||
return MJMLValidator(child, options); | ||
@@ -80,3 +68,3 @@ })))); | ||
return (0, _filter2.default)(errors); | ||
return (0, _lodash.filter)(errors); | ||
} |
@@ -32,4 +32,6 @@ 'use strict'; | ||
} | ||
return true; | ||
} | ||
exports.default = MJMLRulesCollection; |
@@ -41,3 +41,3 @@ 'use strict'; | ||
if (!Component) { | ||
return; | ||
return null; | ||
} | ||
@@ -50,8 +50,16 @@ | ||
if (unknownAttributes.length == 0) { | ||
return; | ||
if (unknownAttributes.length === 0) { | ||
return null; | ||
} | ||
return (0, _ruleError2.default)((unknownAttributes.length > 1 ? 'Attributes' : 'Attribute') + ' ' + unknownAttributes.join(', ') + ' ' + (unknownAttributes.length > 1 ? 'are illegal' : 'is illegal'), element); | ||
var _attribute$illegal = { | ||
attribute: unknownAttributes.length > 1 ? 'Attributes' : 'Attribute', | ||
illegal: unknownAttributes.length > 1 ? 'are illegal' : 'is illegal' | ||
}, | ||
attribute = _attribute$illegal.attribute, | ||
illegal = _attribute$illegal.illegal; | ||
return (0, _ruleError2.default)(attribute + ' ' + unknownAttributes.join(', ') + ' ' + illegal, element); | ||
} | ||
module.exports = exports['default']; |
@@ -35,7 +35,7 @@ 'use strict'; | ||
if (!Component) { | ||
return; | ||
return null; | ||
} | ||
if (!children || children.length == 0) { | ||
return; | ||
if (!children || children.length === 0) { | ||
return null; | ||
} | ||
@@ -42,0 +42,0 @@ |
@@ -24,3 +24,5 @@ 'use strict'; | ||
} | ||
return null; | ||
} | ||
module.exports = exports['default']; |
{ | ||
"name": "mjml-validator", | ||
"description": "mjml-validator", | ||
"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
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
202
12091
11