derhuerst / derhuerst/util-inspect-cli

add support for (static) JS input

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue
Dominant language
JavaScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

It would be cool to be able to pipe JS expressions into `util-inspect`:

```shell
echo '{foo: [{bar: 'baz'}]}' | util-inspect --js
# { foo: [ { bar: 'baz' } ] }
```

It shouldn't *evaluate* the JS expression though, as e.g. `curl | util-inspect` might easily get abused then, but it could

1. parse the JS using [acorn](https://github.com/acornjs/acorn)
2. check if its static (only `ArrayExpression`, `ObjectExpression`, `Property`, `Identifier`, `Literal`)
3. evaluate it
4. inspect it as with JSON input

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.