Skip to content

Commit

Permalink
Merge c253623 into d4a81f4
Browse files Browse the repository at this point in the history
  • Loading branch information
C​⁠‌​⁠⁠‌​​⁠‍‌‌​​‍‌yprien Q​⁠‌​⁠⁠‌​​⁠‍‌‌​​‍‌uilici committed Nov 14, 2019
2 parents d4a81f4 + c253623 commit 152250f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,23 @@ stringify(["test", "string"], function(value, indent, stringify) {
//=> '["test","string"]'
```

## Formatting

You can use your own code formatter on the result of `javascript-stringify`. Here is an example using [eslint](https://www.npmjs.com/package/eslint):

```javascript
const { CLIEngine } = require("eslint");
const { stringify } = require("javascript-stringify");

const { APP_ROOT_PATH, ESLINTRC_FILE_PATH } = require("./constants");

const ESLINT_CLI = new CLIEngine({ fix: true, cwd: APP_ROOT_PATH, configFile: ESLINTRC_FILE_PATH });

module.exports = (objectToStringify) => {
return ESLINT_CLI.executeOnText(stringify(objectToStringify)).results[0].output;
};
```

## License

MIT
Expand Down

0 comments on commit 152250f

Please sign in to comment.