quokka-signet-explorer
Version:
Quokka plugin for exploring API endpoints to identify function signatures
96 lines (66 loc) • 2.33 kB
Markdown
Quokka plugin for exploring API endpoints to identify function signatures and API property types
Install Quokka.js (free or pro)
First install Quokka Signet Explorer via npm:
`npm i quokka-signet-explorer --save-dev`
Next, add the plugin to your Quokka configuration:
```
({
"plugins": [
"quokka-signet-explorer"
]
})
```
If you are running Wallaby, you can use Quokka Signet Explorer. Just require it in your setup file and then run the setup method with all of your other setup scripts:
```
const quokkaSignetExplorer = require('quokkaSignetExplorer');
module.exports = function () {
return {
setup: function () {
quokkaSignetExplorer.setup();
/* other setup goes in here too! */
}
};
}
```
To run Quokka, open a file and type `ctrl/command+k, q`.
Three functions are exposed on the node global scope. In any code you are running, you can get information about functions, objects and modules:
- exploreApi -- `exportedModule:* => variant<string, object>`
- alias of exploreValue
- returns either an object containing property keys with value types or a string describing the type of value provided
- exploreFunction -- `functionToExplore:function => string`
- returns a signet signature string describing the function input values
- exploreValue -- `valueToExplore:* => variant<string, object>`
- returns either an object containing property keys with value types or a string describing the type of value provided
```
const api = {
foo: {
bar: 'baz'
},
add: (a, b = 1) => a + b,
identity: a => a
};
console.log(exploreFunction(api.add)); // a:*, b:[number] => *
console.log(exploreApi(api));
/*
* {
* foo: {
* bar: 'string'
* },
* add: 'a:*, b:[number] => *',
* identity: 'a:* => *'
* }
*/
```
- Enhanced reporting to handle rest arguments
- First release of Quokka Signet Explorer