From 2e7267c67409ae4a5fedf6fbfc0f2c6033408683 Mon Sep 17 00:00:00 2001 From: 0phoff <0phoff@users.noreply.github.com> Date: Tue, 14 Jun 2022 18:04:41 +0200 Subject: [PATCH] Renamed variables after PR Review - `hasLayout` -> `hasInternalLayout` - `consequent` -> `result` --- packages/mdx/lib/plugin/recma-document.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/mdx/lib/plugin/recma-document.js b/packages/mdx/lib/plugin/recma-document.js index 7fa75f808..2b07a2866 100644 --- a/packages/mdx/lib/plugin/recma-document.js +++ b/packages/mdx/lib/plugin/recma-document.js @@ -481,10 +481,10 @@ export function recmaDocument(options = {}) { /** * @param {Expression} [content] - * @param {boolean} [hasLayout] + * @param {boolean} [hasInternalLayout] * @returns {FunctionDeclaration[]} */ - function createMdxContent(content, hasLayout) { + function createMdxContent(content, hasInternalLayout) { /** @type {JSXElement} */ const element = { type: 'JSXElement', @@ -524,13 +524,13 @@ export function recmaDocument(options = {}) { } // @ts-expect-error: JSXElements are expressions. - let consequent = /** @type {Expression} */ (element) + let result = /** @type {Expression} */ (element) - if (!hasLayout) { - consequent = { + if (!hasInternalLayout) { + result = { type: 'ConditionalExpression', test: {type: 'Identifier', name: 'MDXLayout'}, - consequent, + consequent: result, alternate: { type: 'CallExpression', callee: {type: 'Identifier', name: '_createMdxContent'}, @@ -580,7 +580,7 @@ export function recmaDocument(options = {}) { body: [ { type: 'ReturnStatement', - argument: consequent + argument: result } ] }