From 90e6cb94e9c9a4d055a0983c9c7386daa48f61f9 Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期四, 09 六月 2022 15:45:03 +0800
Subject: [PATCH] TODO#139893 [ FAQ 常見問題 -我進行預約後,顧問會用甚麼方式聯繫我? ] 文案調整

---
 PAMapp/node_modules/jest-diff/build/index.js |   74 ++++++++++++++++++-------------------
 1 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/PAMapp/node_modules/jest-diff/build/index.js b/PAMapp/node_modules/jest-diff/build/index.js
index c0d7505..e3f2c45 100644
--- a/PAMapp/node_modules/jest-diff/build/index.js
+++ b/PAMapp/node_modules/jest-diff/build/index.js
@@ -3,7 +3,6 @@
 Object.defineProperty(exports, '__esModule', {
   value: true
 });
-exports.diff = diff;
 Object.defineProperty(exports, 'DIFF_DELETE', {
   enumerable: true,
   get: function () {
@@ -28,6 +27,7 @@
     return _cleanupSemantic.Diff;
   }
 });
+exports.diff = diff;
 Object.defineProperty(exports, 'diffLinesRaw', {
   enumerable: true,
   get: function () {
@@ -121,13 +121,11 @@
 const FORMAT_OPTIONS = {
   plugins: PLUGINS
 };
-const FORMAT_OPTIONS_0 = {...FORMAT_OPTIONS, indent: 0};
 const FALLBACK_FORMAT_OPTIONS = {
   callToJSON: false,
   maxDepth: 10,
   plugins: PLUGINS
-};
-const FALLBACK_FORMAT_OPTIONS_0 = {...FALLBACK_FORMAT_OPTIONS, indent: 0}; // Generate a string that will highlight the difference between two values
+}; // Generate a string that will highlight the difference between two values
 // with green and red. (similar to how github does code diffing)
 // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
 
@@ -215,47 +213,20 @@
 function compareObjects(a, b, options) {
   let difference;
   let hasThrown = false;
-  const noDiffMessage = getCommonMessage(_constants.NO_DIFF_MESSAGE, options);
 
   try {
-    const aCompare = (0, _prettyFormat.format)(a, FORMAT_OPTIONS_0);
-    const bCompare = (0, _prettyFormat.format)(b, FORMAT_OPTIONS_0);
-
-    if (aCompare === bCompare) {
-      difference = noDiffMessage;
-    } else {
-      const aDisplay = (0, _prettyFormat.format)(a, FORMAT_OPTIONS);
-      const bDisplay = (0, _prettyFormat.format)(b, FORMAT_OPTIONS);
-      difference = (0, _diffLines.diffLinesUnified2)(
-        aDisplay.split('\n'),
-        bDisplay.split('\n'),
-        aCompare.split('\n'),
-        bCompare.split('\n'),
-        options
-      );
-    }
+    const formatOptions = getFormatOptions(FORMAT_OPTIONS, options);
+    difference = getObjectsDifference(a, b, formatOptions, options);
   } catch {
     hasThrown = true;
-  } // If the comparison yields no results, compare again but this time
+  }
+
+  const noDiffMessage = getCommonMessage(_constants.NO_DIFF_MESSAGE, options); // If the comparison yields no results, compare again but this time
   // without calling `toJSON`. It's also possible that toJSON might throw.
 
   if (difference === undefined || difference === noDiffMessage) {
-    const aCompare = (0, _prettyFormat.format)(a, FALLBACK_FORMAT_OPTIONS_0);
-    const bCompare = (0, _prettyFormat.format)(b, FALLBACK_FORMAT_OPTIONS_0);
-
-    if (aCompare === bCompare) {
-      difference = noDiffMessage;
-    } else {
-      const aDisplay = (0, _prettyFormat.format)(a, FALLBACK_FORMAT_OPTIONS);
-      const bDisplay = (0, _prettyFormat.format)(b, FALLBACK_FORMAT_OPTIONS);
-      difference = (0, _diffLines.diffLinesUnified2)(
-        aDisplay.split('\n'),
-        bDisplay.split('\n'),
-        aCompare.split('\n'),
-        bCompare.split('\n'),
-        options
-      );
-    }
+    const formatOptions = getFormatOptions(FALLBACK_FORMAT_OPTIONS, options);
+    difference = getObjectsDifference(a, b, formatOptions, options);
 
     if (difference !== noDiffMessage && !hasThrown) {
       difference =
@@ -267,3 +238,30 @@
 
   return difference;
 }
+
+function getFormatOptions(formatOptions, options) {
+  const {compareKeys} = (0, _normalizeDiffOptions.normalizeDiffOptions)(
+    options
+  );
+  return {...formatOptions, compareKeys};
+}
+
+function getObjectsDifference(a, b, formatOptions, options) {
+  const formatOptionsZeroIndent = {...formatOptions, indent: 0};
+  const aCompare = (0, _prettyFormat.format)(a, formatOptionsZeroIndent);
+  const bCompare = (0, _prettyFormat.format)(b, formatOptionsZeroIndent);
+
+  if (aCompare === bCompare) {
+    return getCommonMessage(_constants.NO_DIFF_MESSAGE, options);
+  } else {
+    const aDisplay = (0, _prettyFormat.format)(a, formatOptions);
+    const bDisplay = (0, _prettyFormat.format)(b, formatOptions);
+    return (0, _diffLines.diffLinesUnified2)(
+      aDisplay.split('\n'),
+      bDisplay.split('\n'),
+      aCompare.split('\n'),
+      bCompare.split('\n'),
+      options
+    );
+  }
+}

--
Gitblit v1.8.0