Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/andstor/smart-contract-slicer

:scissors: Utility for slicing contracts into pieces.
https://github.com/andstor/smart-contract-slicer

Last synced: 1 day ago
JSON representation

:scissors: Utility for slicing contracts into pieces.

Awesome Lists containing this project

README

        

# smart-contract-slicer

> :scissors: Utility for slicing contracts into pieces.

## Install
```
$ npm install @andstor/smart-contract-slicer
```

## Usage
```js
import { Slicer } from '@andstor/smart-contract-slicer';

const input = `
contract test {
uint256 a;
function f1() {
return 1;
}
function f2() {
return 2;
}
}
`
let slices = slicer.sliceAtNode("FunctionDefinition", 1, "firstLine")
console.log(slices)[0]
/*
contract test {
uint256 a;
function f1() {
*/
```
## License

Copyright © 2022 [André Storhaug](https://github.com/andstor)

smart-contract-slicer is licensed under the [MIT License](https://github.com/andstor/smart-contract-slicer/blob/master/LICENSE).