Add list of static functions
This commit is contained in:
@@ -28,6 +28,14 @@ function getClassName(longname) {
|
||||
return longname.split('~').pop();
|
||||
}
|
||||
|
||||
function getFunctionName(longname) {
|
||||
return longname.split('.').pop();
|
||||
}
|
||||
|
||||
function isMember(symbol) {
|
||||
return symbol.name.indexOf('#') !== -1;
|
||||
}
|
||||
|
||||
function slugify(name) {
|
||||
return name.replace(/[#~\.]/g, '-');
|
||||
}
|
||||
@@ -43,6 +51,10 @@ class Docs extends Component {
|
||||
{mod.symbols
|
||||
.filter(sym => sym.kind === 'class')
|
||||
.map(cls => this.renderClass(cls, mod))}
|
||||
<h2>Functions</h2>
|
||||
{mod.symbols
|
||||
.filter(sym => sym.kind === 'function' && !isMember(sym))
|
||||
.map(fn => this.renderFunction(fn, mod))}
|
||||
</a>
|
||||
</section>
|
||||
);
|
||||
@@ -58,6 +70,18 @@ class Docs extends Component {
|
||||
);
|
||||
}
|
||||
|
||||
renderFunction(fn, mod) {
|
||||
return (
|
||||
<p key={fn.name}>
|
||||
<code>
|
||||
import {{getFunctionName(fn.name)}} from '{getModuleName(
|
||||
mod.name
|
||||
)}';
|
||||
</code>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>{modules.filter(mod => !!mod.symbols).map(this.renderModule)}</div>
|
||||
|
||||
Reference in New Issue
Block a user