mso-conditional-parser
Advanced tools
+8
-8
| { | ||
| "name": "mso-conditional-parser", | ||
| "version": "1.1.0", | ||
| "version": "1.1.1", | ||
| "description": "Parser and translator for MSO (Outlook) conditional comments in HTML email", | ||
@@ -45,11 +45,11 @@ "type": "module", | ||
| "@eslint/js": "^10.0.1", | ||
| "eslint": "^10.1.0", | ||
| "eslint": "^10.6.0", | ||
| "eslint-config-prettier": "^10.1.8", | ||
| "eslint-plugin-jsdoc": "^62.0.0", | ||
| "eslint-plugin-prettier": "^5.5.0", | ||
| "eslint-plugin-unicorn": "^64.0.0", | ||
| "globals": "^17.4.0", | ||
| "eslint-plugin-jsdoc": "^63.0.13", | ||
| "eslint-plugin-prettier": "^5.5.6", | ||
| "eslint-plugin-unicorn": "^71.1.0", | ||
| "globals": "^17.7.0", | ||
| "husky": "^9.1.7", | ||
| "lint-staged": "^17.0.5", | ||
| "prettier": "^3.8.2" | ||
| "lint-staged": "^17.0.8", | ||
| "prettier": "^3.9.5" | ||
| }, | ||
@@ -56,0 +56,0 @@ "lint-staged": { |
+1
-1
@@ -7,3 +7,3 @@ # mso-conditional-parser | ||
| Used as the core engine by [`eslint-plugin-mso`](https://github.com/JoernBerkefeld/eslint-plugin-mso) and the [`MSO Conditional Comments`](https://marketplace.visualstudio.com/items?itemName=joernberkefeld.mso-conditionals) VS Code extension. | ||
| Used as the core engine by [`eslint-plugin-mso-email`](https://github.com/JoernBerkefeld/eslint-plugin-mso-email) and the [`MSO Conditional Comments`](https://marketplace.visualstudio.com/items?itemName=joernberkefeld.mso-conditionals) VS Code extension. | ||
@@ -10,0 +10,0 @@ ## Installation |
+18
-22
@@ -165,3 +165,3 @@ /** | ||
| if (trimmed === 'mso' || trimmed === '!mso' || trimmed === 'IE' || trimmed === '!IE') { | ||
| if (['mso', '!mso', 'IE', '!IE'].includes(trimmed)) { | ||
| return null; | ||
@@ -265,7 +265,7 @@ } | ||
| * | ||
| * @param {string} str - Raw HTML comment string (trimmed). | ||
| * @param {string} string_ - Raw HTML comment string (trimmed). | ||
| * @returns {{ type: string, condition: string, translation: string, isValid: boolean, error?: string } | null} Parsed opener object, or null if not an MSO opener. | ||
| */ | ||
| export function parseMsoComment(str) { | ||
| const trimmed = str.trim(); | ||
| export function parseMsoComment(string_) { | ||
| const trimmed = string_.trim(); | ||
@@ -282,8 +282,6 @@ // Downlevel-revealed non-standard: <![if condition]> | ||
| isValid: !assessment, | ||
| ...(assessment | ||
| ? { | ||
| error: assessment.error, | ||
| ...(assessment.fix ? { conditionFix: assessment.fix } : {}), | ||
| } | ||
| : {}), | ||
| ...(assessment && { | ||
| error: assessment.error, | ||
| ...(assessment.fix && { conditionFix: assessment.fix }), | ||
| }), | ||
| }; | ||
@@ -303,8 +301,6 @@ } | ||
| isValid: !assessment, | ||
| ...(assessment | ||
| ? { | ||
| error: assessment.error, | ||
| ...(assessment.fix ? { conditionFix: assessment.fix } : {}), | ||
| } | ||
| : {}), | ||
| ...(assessment && { | ||
| error: assessment.error, | ||
| ...(assessment.fix && { conditionFix: assessment.fix }), | ||
| }), | ||
| }; | ||
@@ -326,7 +322,7 @@ } | ||
| * | ||
| * @param {string} str - Raw HTML comment string (trimmed). | ||
| * @param {string} string_ - Raw HTML comment string (trimmed). | ||
| * @returns {{ type: string, isClosing: true } | null} Parsed closer object, or null if not an MSO closer. | ||
| */ | ||
| export function parseMsoEndComment(str) { | ||
| const trimmed = str.trim(); | ||
| export function parseMsoEndComment(string_) { | ||
| const trimmed = string_.trim(); | ||
@@ -347,7 +343,7 @@ if (HIDDEN_CLOSER_RE.test(trimmed)) { | ||
| * | ||
| * @param {string} str - Raw HTML comment string. | ||
| * @param {string} string_ - Raw HTML comment string. | ||
| * @returns {boolean} True if the string is a recognized MSO comment opener or closer. | ||
| */ | ||
| export function isMsoComment(str) { | ||
| return parseMsoComment(str) !== null || parseMsoEndComment(str) !== null; | ||
| export function isMsoComment(string_) { | ||
| return parseMsoComment(string_) !== null || parseMsoEndComment(string_) !== null; | ||
| } |
17271
-0.56%299
-1.32%