瀏覽代碼

Tidied JSON Beautify op. Changed default indent to 4 spaces instead of a tab.

n1474335 6 年之前
父節點
當前提交
6f4ee8b7b6

+ 3 - 3
src/core/operations/JSONBeautify.mjs

@@ -28,7 +28,7 @@ class JSONBeautify extends Operation {
             {
                 "name": "Indent string",
                 "type": "binaryShortString",
-                "value": "\\t"
+                "value": "    "
             },
             {
                 "name": "Sort Object Keys",
@@ -44,8 +44,8 @@ class JSONBeautify extends Operation {
      * @returns {string}
      */
     run(input, args) {
-        const indentStr = args[0];
-        const sortBool = args[1];
+        const [indentStr, sortBool] = args;
+
         if (!input) return "";
         if (sortBool) {
             input = JSON.stringify(JSONBeautify._sort(JSON.parse(input)));

+ 1 - 1
test/tests/operations/JSONBeautify.mjs

@@ -3,7 +3,7 @@
  *
  * @author Phillip Nordwall [Phillip.Nordwall@gmail.com]
  *
- * @copyright Crown Copyright 2017
+ * @copyright Crown Copyright 2018
  * @license Apache-2.0
  */
 import TestRegister from "../../TestRegister";

+ 1 - 1
test/tests/operations/JSONMinify.mjs

@@ -3,7 +3,7 @@
  *
  * @author Phillip Nordwall [Phillip.Nordwall@gmail.com]
  *
- * @copyright Crown Copyright 2017
+ * @copyright Crown Copyright 2018
  * @license Apache-2.0
  */
 import TestRegister from "../../TestRegister";