1.13.7-1 • Published 7 years ago

refmt v1.13.7-1

Weekly downloads
10
License
BSD-3-Clause
Repository
github
Last release
7 years ago

refmt-js

refmt packaged as a JS library

Installation

npm i refmt

Usage

const refmt = require('refmt')

const myReasonMLCode = fs.readFileSync('file.re')
const formattedCode = refmt(myReasonMLCode)

API

refmt(source: string, sourceLang: string?, sourceType: string?, targetLang: string?): string

The refmt function will output styled ReasonML or OCaml source code. The only required param is source, the input source code. sourceLang specifies the input language, defaulted to Reason. Specify 'RE' for Reason, or 'ML' for OCaml input. sourceType specifies the source code type, either 'implementation' or 'interface', defaults to implementation. targetLang specifies the output language, 'RE' for Reason, or 'ML' for OCaml, defaults to Reason.

Source Maps

The distibution also includes a sourcemap for the compiled JS. To enable Node to use the provided source map, please use source-map-support.