Skip to content

Instantly share code, notes, and snippets.

@gladimdim
Created December 18, 2017 12:29
Show Gist options
  • Save gladimdim/d014d71f28453c84ac239cf78e1a0ed3 to your computer and use it in GitHub Desktop.
Save gladimdim/d014d71f28453c84ac239cf78e1a0ed3 to your computer and use it in GitHub Desktop.
Compiled to JS reason records
// Generated by BUCKLESCRIPT VERSION 2.1.0, PLEASE EDIT WITH CARE
'use strict';
var Block = require("bs-platform/lib/js/block.js");
var Json_decode = require("bs-json/src/Json_decode.js");
function createCountWithLabel(label) {
return /* record */[
/* type_ */"COUNT",
/* label */label
];
}
function transformToCount20(oldJson) {
var label = Json_decode.optional((function (param) {
return Json_decode.field("label", Json_decode.string, param);
}), oldJson);
if (label) {
return /* MetricWithLabel */Block.__(1, [/* record */[
/* type_ */"COUNT",
/* label */label[0]
]]);
} else {
return /* MetricCount */Block.__(0, [/* record */[/* type_ */"COUNT"]]);
}
}
exports.createCountWithLabel = createCountWithLabel;
exports.transformToCount20 = transformToCount20;
/* No side effect */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment