@wasm-fmt/clang-format 0.2.9 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/clang-format.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,14 +29,14 @@ std::cout << "Hello World!" << std::endl;
|
|
|
29
29
|
return 0;}
|
|
30
30
|
`;
|
|
31
31
|
|
|
32
|
-
// JSON
|
|
32
|
+
// JSON representation of Clang-Format Style Options
|
|
33
33
|
const config = JSON.stringify({
|
|
34
34
|
BasedOnStyle: "Chromium",
|
|
35
35
|
IndentWidth: 4,
|
|
36
36
|
ColumnLimit: 80,
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
// or
|
|
39
|
+
// or YAML representation of Clang-Format Style Options which is used in `.clang-format` file
|
|
40
40
|
const config2 = `---
|
|
41
41
|
BasedOnStyle: Chromium
|
|
42
42
|
IndentWidth: 4
|
|
@@ -45,6 +45,9 @@ ColumnLimit: 80
|
|
|
45
45
|
...
|
|
46
46
|
`;
|
|
47
47
|
|
|
48
|
+
// or the preset name
|
|
49
|
+
const config3 = "Chromium";
|
|
50
|
+
|
|
48
51
|
const formatted = format(
|
|
49
52
|
source,
|
|
50
53
|
"main.cc",
|
|
@@ -54,7 +57,12 @@ const formatted = format(
|
|
|
54
57
|
console.log(formatted);
|
|
55
58
|
```
|
|
56
59
|
|
|
57
|
-
The third argument of `format`
|
|
60
|
+
The third argument of `format` is a Clang-Format Style Options, which can be one of the following:
|
|
61
|
+
|
|
62
|
+
1. A preset: LLVM, GNU, Google, Chromium, Microsoft, Mozilla, WebKit.
|
|
63
|
+
2. A YAML/JSON string representing the style options.
|
|
64
|
+
3. the string content of a `.clang-format` file.
|
|
65
|
+
|
|
58
66
|
See [Clang-Format Style Options](https://clang.llvm.org/docs/ClangFormatStyleOptions.html) for more information.
|
|
59
67
|
|
|
60
68
|
# Build from source
|
package/clang-format.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED