Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/andstor/smart-contract-slicer
- Owner: andstor
- License: mit
- Created: 2022-03-20T16:58:22.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-03-21T17:30:47.000Z (over 2 years ago)
- Last Synced: 2024-10-11T19:48:23.310Z (about 1 month ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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() {
*/
```
## LicenseCopyright © 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).