@ryanforever/help
v2.1.1
Published
helper utility for your classes
Downloads
2
Readme
HELP
add a nifty help function to your class to help users with its methods
const Thing = require("thing")
const thing = new Thing()
thing.help() // add a function that outputs method help to the console
usage
backend code
in your class or constructor function, add comments prefixed with //!
over each method you want to show in the help log.
then, add a method called .help()
or something, and assign it to the help function
const help = require("@ryanforever/help")
function MyClass() {
//! returns hello world
this.foo = async function() {
...
}
//! summons ghost
this.bar = async function() {
...
}
//! important setting
this.baz = 50
this.help = help
}
client code
when a user instantiates your class and calls your help
method, info about the methods will be logged to the console.
const MyClass = require("my-class")
const myClass = new MyClas()
myClass.help()
this will output the following:
╔══════════════════════════════╗
║ METHOD HELP ║
║ here are the methods of ║
║ "MyClass" ║
║ /constructor.js ║
╟────────┬─────────────────────╢
║ NAME │ DESCRIPTION ║
╟────────┼─────────────────────╢
║ .foo() │ returns hello world ║
╟────────┼─────────────────────╢
║ .bar() │ summons ghost ║
╟────────┼─────────────────────╢
║ baz │ important setting ║
╚════════╧═════════════════════╝