Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/prettier-solidity/solidity-comments-extractor

Extract comments from Solidity code
https://github.com/prettier-solidity/solidity-comments-extractor

ethereum prettier prettier-plugin solidity

Last synced: 8 days ago
JSON representation

Extract comments from Solidity code

Awesome Lists containing this project

README

        

# solidity-comments-extractor

Extract comments from Solidity code

## How to

```js
const expect = require('expect');
const extractComments = require('./index');

const code = `
// this is a contract
contract Foo {
}
`;

const comments = extractComments(code);

expect(comments).toEqual([
{
range: [1, 22],
raw: ' this is a contract',
type: 'LineComment',
value: ' this is a contract'
}
]);
```