https://github.com/wokwi/astyle-wasm
Artistic Style (AStyle) compiled for Web Assembly
https://github.com/wokwi/astyle-wasm
Last synced: 6 months ago
JSON representation
Artistic Style (AStyle) compiled for Web Assembly
- Host: GitHub
- URL: https://github.com/wokwi/astyle-wasm
- Owner: wokwi
- License: mit
- Created: 2019-12-29T10:18:00.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-18T04:27:38.000Z (over 1 year ago)
- Last Synced: 2025-06-18T12:51:07.887Z (6 months ago)
- Language: JavaScript
- Size: 227 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# astyle-wasm
Artistic Style (AStyle) compiled for Web Assembly
[](https://github.com/wokwi/astyle-wasm/actions)
## Installation
To install the package, run the following command:
```
npm install --save astyle
```
For yarn users:
```
yarn add astyle
```
## Usage example
```javascript
const { format } = require('astyle');
format('void foo(){\nbar();}').then(result => {
console.log(result);
});
// Output:
// void foo() {
// bar();
// }
```
You can also pass AStyle options as a second argument for `format()`. For instance, you can
change the indentation to tabs by specifying `'indent=tab'`. The full list of options
can be found in [the AStyle docs](http://astyle.sourceforge.net/astyle.html#_Brace_Style_Options).
Note: The package is currently supported only on Node.js. A web version may be available in the future.
## Building the project and running the tests
You will need docker installed. To build:
```bash
npm run build:image
npm run build:copy
```
Then run the tests by executing:
```
npm test
```