Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function buildTypography(typographyDir) {
console.log("Building Typography Variables");
console.log("Reading data from " + typographyDir);
var dir = List.hd(List.filter((function (file) {
return +(file !== "page.json");
}))($$Array.to_list(Fs.readdirSync(typographyDir))));
var typos = List.map((function (json) {
return /* record */[
/* name */Caml_array.caml_array_get(Json_decode.field("overrideValues", (function (param) {
return Json_decode.array((function (param) {
return Json_decode.field("value", Json_decode.string, param);
}), param);
}), json), 0),
/* value */Caml_array.caml_array_get(Json_decode.field("overrideValues", (function (param) {
return Json_decode.array((function (param) {
return Json_decode.field("value", Json_decode.string, param);
}), param);
}), json), 1)
];
}), List.map(Json.parseOrRaise, List.map((function (file) {
var typos = List.map((function (json) {
return /* record */[
/* name */Caml_array.caml_array_get(Json_decode.field("overrideValues", (function (param) {
return Json_decode.array((function (param) {
return Json_decode.field("value", Json_decode.string, param);
}), param);
}), json), 0),
/* value */Caml_array.caml_array_get(Json_decode.field("overrideValues", (function (param) {
return Json_decode.array((function (param) {
return Json_decode.field("value", Json_decode.string, param);
}), param);
}), json), 1)
];
}), List.map(Json.parseOrRaise, List.map((function (file) {
return Fs.readFileSync(typographyDir + ("/" + (dir + ("/" + file))), "utf8");
}), List.filter((function (file) {
return +(file !== "artboard.json");
}))($$Array.to_list(Fs.readdirSync(typographyDir + ("/" + dir)))))));
return /* Typography */Block.__(1, [typos]);
}
function suggest_2(funcs, input1, input2, output) {
return $$Array.of_list(List.map((function (prim) {
return prim[1];
}), List.filter((function (param) {
return +(Curry._2(param[0], input1, input2) === output);
}))(funcs)));
}
function classNames(names) {
return List.fold_left((function (a, b) {
return a + (" " + b);
}), "", List.filter((function (name) {
return name !== "";
}))(names));
}
function suggest_3(funcs, input1, input2, input3, output) {
return $$Array.of_list(List.map((function (prim) {
return prim[1];
}), List.filter((function (param) {
return +(Curry._3(param[0], input1, input2, input3) === output);
}))(funcs)));
}
function suggest_1(funcs, input, output) {
return $$Array.of_list(List.map((function (prim) {
return prim[1];
}), List.filter((function (param) {
return +(Curry._1(param[0], input) === output);
}))(funcs)));
}