generic-jsx

2 years after

You can find a full explanation of the ideas behind this here.

Or, try it on Tonic!

Generic JSX

This is a version of JSX for general purpose programming. Why would you want that? Well, it gives us the ability to have curried named parameters in JavaScript.

How Do I use It?

If you are using Babel, then all you should need to do is the following:

/* @jsx curry(_=>eval(_)) */
var { curry } = require("generic-jsx");

Now you'll be able make functions with named parameters that you can curry:

var fs = require("fs");
var readFileSync = ({ name, encoding }) => fs.readFileSync(name, encoding);

// ...
var readString = <readFileSync encode = "utf8"/>;

<readString name = "package.json"/>();

Or, use with data structures!

/* @jsx (curry(_=>eval(_))) */
var { curry, from } = require("generic-jsx");
var BinaryTree = require("generic-jsx/binary-tree");

// This represents 5 / ( 4 + 6)
<BinaryTree value = "/">
    <BinaryTree value = { 5 } />
    <BinaryTree value = "+">
        <BinaryTree value = { 4 } />
        <BinaryTree value = { 6 } />
    </BinaryTree>
</BinaryTree>()

Related Repositories

tilt

tilt

Generic interface to multiple Ruby template engines ...

jsx

jsx

The JSX specification is a XML-like syntax extension to ECMAScript. ...

component-check

component-check

A quick introduction to exploring how components can be created in several frame ...

react-native-controllers

react-native-controllers

Native IOS Navigation for React Native (navbar, tabs, drawer) ...

demokit

demokit

DemoKit is a Library and Electron app for building product demos and tutorials u ...


Top Contributors

tolmasky