Here I have some code that bucklescript has compiled, and the indentation makes it look very weird
// Generated by BUCKLESCRIPT VERSION 5.0.4, PLEASE EDIT WITH CARE
'use strict';
var Jest = require("@glennsl/bs-jest/src/jest.js");
((global.fetch = require('node-fetch')));
Jest.describe("Server", (function (param) {
return Jest.testPromise("request", undefined, (function (param) {
var __x = fetch("https://api.ipify.org?format=json");
var __x$1 = __x.then((function (prim) {
return prim.text();
}));
return __x$1.then((function (text) {
return Promise.resolve(Jest.Expect[/* toBe */2]("{\"ip\":\"83.93.187.177\"}", Jest.Expect[/* expect */0](text)));
}));
}));
}));
/* Not a pure module */
The reasonml
[%raw "global.fetch = require('node-fetch')"];
open Jest;
open Expect;
open Js.Promise;
describe("Server", () =>
testPromise("request", () =>
Fetch.fetch("https://api.ipify.org?format=json")
->then_(Fetch.Response.text, _)
->then_(
text =>
expect(text) |> toBe("{\"ip\":\"83.93.187.177\"}") |> resolve,
_,
)
)
);
and how it would look if you ran it through prettier:
// Generated by BUCKLESCRIPT VERSION 5.0.4, PLEASE EDIT WITH CARE
"use strict";
var Jest = require("@glennsl/bs-jest/src/jest.js");
global.fetch = require("node-fetch");
Jest.describe("Server", function(param) {
return Jest.testPromise("request", undefined, function(param) {
var __x = fetch("https://api.ipify.org?format=json");
var __x$1 = __x.then(function(prim) {
return prim.text();
});
return __x$1.then(function(text) {
return Promise.resolve(
Jest.Expect[/* toBe */ 2](
'{"ip":"83.93.187.177"}',
Jest.Expect[/* expect */ 0](text)
)
);
});
});
});
/* Not a pure module */