1.0.3 • Published 6 years ago

js-of-reason v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

Basic Reason Template

This module converts a snippet of reasonML to javascript.

Example

const jsOfReason = require("js-of-reason")
const reasonCode = `let add = (a,b) => {
  a + b;
}`

jsOfReason(reasonCode, (error, jsCode) => {
  if(error){
    console.log(error)
  } else {
    console.log(jsCode)         // function add(a, b) {
                                //   return a + b | 0;
                                // }
  }
})

const codeWithError = `let add = (a,b) => {
  a + b + "2";
}`

jsOfReason(codeWithError, (error, jsCode) => {
  if(error){
    console.log(error)          // <type error>
                                //   1 │ let add = (a,b) => {
                                //   2 │   a + b + "2";
                                //   3 │ }
                                //   This has type:
                                //     string
                                //   But somewhere wanted:
                                //     int
  } else {
    console.log(jsCode)
  }
})
1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago