npm.io
0.0.8 • Published 2 years ago

solidity-comments-extractor

Licence
MIT
Version
0.0.8
Deps
0
Size
10 kB
Vulns
0
Weekly
0
Stars
6

solidity-comments-extractor

Extract comments from Solidity code

How to

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'
  }
]);