Add Decodal formatter
This commit is contained in:
@@ -22,15 +22,15 @@ deno add jsr:@hare/decodal-wasm
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import init, { evaluateProject } from 'decodal-wasm';
|
||||
import init, { evaluateProject, formatSource } from 'decodal-wasm';
|
||||
|
||||
await init();
|
||||
|
||||
const result = evaluateProject(JSON.stringify({
|
||||
entry: 'main.dcdl',
|
||||
files: {
|
||||
'main.dcdl': 'Server = { port = Int default 8080; };',
|
||||
},
|
||||
const formatted = JSON.parse(formatSource('Server={port=Int default 8080;};'));
|
||||
console.log(formatted.source);
|
||||
|
||||
const result = evaluateProject('main.dcdl', JSON.stringify({
|
||||
'main.dcdl': 'Server = { port = Int default 8080; };',
|
||||
}));
|
||||
|
||||
console.log(JSON.parse(result));
|
||||
|
||||
Reference in New Issue
Block a user