1- const { isNodeType, findAll } = require ( 'solidity-ast/utils' ) ;
2- const { slug } = require ( './helpers' ) ;
1+ import { isNodeType , findAll } from 'solidity-ast/utils.js' ;
2+ import { slug } from './helpers' ;
33
4- module . exports . anchor = function anchor ( { item, contract } ) {
4+ export const anchor = function anchor ( { item, contract } ) {
55 let res = '' ;
66 if ( contract ) {
77 res += contract . name + '-' ;
@@ -17,7 +17,7 @@ module.exports.anchor = function anchor({ item, contract }) {
1717 return res ;
1818} ;
1919
20- module . exports . fullname = function fullname ( { item } ) {
20+ export const fullname = function fullname ( { item } ) {
2121 let res = '' ;
2222 res += item . name ;
2323 if ( 'parameters' in item ) {
@@ -33,7 +33,7 @@ module.exports.fullname = function fullname({ item }) {
3333 return res ;
3434} ;
3535
36- module . exports . inheritance = function ( { item, build } ) {
36+ export const inheritance = function ( { item, build } ) {
3737 if ( ! isNodeType ( 'ContractDefinition' , item ) ) {
3838 throw new Error ( 'inheritance modifier used on non-contract' ) ;
3939 }
@@ -43,42 +43,42 @@ module.exports.inheritance = function ({ item, build }) {
4343 . filter ( ( c , i ) => c . name !== 'Context' || i === 0 ) ;
4444} ;
4545
46- module . exports [ 'has-functions' ] = function ( { item } ) {
46+ export const hasFunctions = function ( { item } ) {
4747 return item . inheritance . some ( c => c . functions . length > 0 ) ;
4848} ;
4949
50- module . exports [ 'has-events' ] = function ( { item } ) {
50+ export const hasEvents = function ( { item } ) {
5151 return item . inheritance . some ( c => c . events . length > 0 ) ;
5252} ;
5353
54- module . exports [ 'has-errors' ] = function ( { item } ) {
54+ export const hasErrors = function ( { item } ) {
5555 return item . inheritance . some ( c => c . errors . length > 0 ) ;
5656} ;
5757
58- module . exports [ 'internal-variables' ] = function ( { item } ) {
58+ export const internalVariables = function ( { item } ) {
5959 return item . variables . filter ( ( { visibility } ) => visibility === 'internal' ) ;
6060} ;
6161
62- module . exports [ 'has-internal-variables' ] = function ( { item } ) {
63- return module . exports [ 'internal-variables' ] ( { item } ) . length > 0 ;
62+ export const hasInternalVariables = function ( { item } ) {
63+ return internalVariables ( { item } ) . length > 0 ;
6464} ;
6565
66- module . exports . functions = function ( { item } ) {
66+ export const functions = function ( { item } ) {
6767 return [
6868 ...[ ...findAll ( 'FunctionDefinition' , item ) ] . filter ( f => f . visibility !== 'private' ) ,
6969 ...[ ...findAll ( 'VariableDeclaration' , item ) ] . filter ( f => f . visibility === 'public' ) ,
7070 ] ;
7171} ;
7272
73- module . exports . returns2 = function ( { item } ) {
73+ export const returns2 = function ( { item } ) {
7474 if ( isNodeType ( 'VariableDeclaration' , item ) ) {
7575 return [ { type : item . typeName . typeDescriptions . typeString } ] ;
7676 } else {
7777 return item . returns ;
7878 }
7979} ;
8080
81- module . exports [ 'inherited-functions' ] = function ( { item } ) {
81+ export const inheritedFunctions = function ( { item } ) {
8282 const { inheritance } = item ;
8383 const baseFunctions = new Set ( inheritance . flatMap ( c => c . functions . flatMap ( f => f . baseFunctions ?? [ ] ) ) ) ;
8484 return inheritance . map ( ( contract , i ) => ( {
0 commit comments