-
Notifications
You must be signed in to change notification settings - Fork 102
REPL documentation
Folktale is annotated with Meta:Magical, so every runtime Folktale object contains documentation annotation that you can retrieve interactively.
You can look at the documentation in the REPL using the REPL browser.
To look at Folktale's documentation you need to install metamagical-interface
and metamagical-repl
:
npm install [email protected]
npm install [email protected]
Once that's taken care of, you can look at documentation by loading the documentation
submodule:
var docs = require('folktale/documentation');
docs
is a browser pointing to the root of the Folktale library. From there
you can invoke the following methods:
-
.forProperty(name)
— returns a new Browser for the object you can reach at that property in the current object.docs.forProperty("core")
returns a Browser for thecore
module, for example. -
.source()
— returns the original source code of the current object. This is the source code before the Babel compilation pass, so it's actual, human-written ES6 code! — and for objects too, not only functions. -
.stability()
— returns the stability of the current object, considering all of the objects below it. So if an object is made out of experimental objects, it'll also be considered experimental. -
.documentation()
— returns the full documentation of the object. This is usually a huge chunk of (formatted for TTY) markdown, containing examples, explanations of why a feature exists, when you would use it, how it works under the hood, and others. The new version of Folktale places a heavy emphasis on documentation. -
.summary()
— returns a summary of the object. Its signature, type, where it's defined, a short summary of its documentation, the properties in the object, and some other meta-data.