Home

Awesome

rfx

Self documenting runtime interfaces.

In rfx, interfaces are called fx. The r stands for rtype.

What does rfx do?

rfx lets you easily specify rtypes in standard JavaScript. What could be possible with rtypes?

It's driven by the idea originally inspired by Lisp: Code as data. We're extending this concept to type information and documentation metadata.

This provides several benefits, but importantly, it makes your code literally self-documenting, and paves the way for powerful in-app developer tooling that is not available using compile-time type systems such as TypeScript. (Note: The TypeScript team is actively working on runtime type reflection, but it currently requires you to opt-in to experimental TypeScript features, and it works using the unstable Reflect API proposal for some future ES Next).

Status - Ready for Testing & Feedback

The documentation features of rfx are working today. Feel free to experiment and open an issue with your comments.

Getting Started

rfx is super easy to use. In place of a regular function expression or declaration, call the rfx with a tagged template literal containing your rtype documentation. The rtype function is a curried function that will return a function that you pass your code into.

npm install --save rfx
import rfx from 'rfx';

const add2 = rfx`
// Take two values, a & b, and return the sum.
add2(a: n, b: n) => Number
`(
  (a, b) => a + b
);

add2.rfx(); // logs tagged description to the console.

See rtype for more info.

Brought to You by Learn JavaScript with Eric Elliott

<a href="https://ericelliottjs.com"><img width="1200" alt="eejs-screenshot" src="https://cloud.githubusercontent.com/assets/364727/8640836/76d86618-28c3-11e5-8b6e-27d9cd72180e.png"></a>

Join the chat at https://gitter.im/learn-javascript-courses/javascript-questions

An online course series for application developers. Ready to jump in? Learn more.