UNPKG

envio

Version:

A latency and sync speed optimized, developer friendly blockchain data indexer.

78 lines (59 loc) 1.73 kB
// Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; var Caml = require("rescript/lib/js/caml.js"); var Js_exn = require("rescript/lib/js/js_exn.js"); var Belt_Id = require("rescript/lib/js/belt_Id.js"); var Belt_Map = require("rescript/lib/js/belt_Map.js"); var Belt_Option = require("rescript/lib/js/belt_Option.js"); var Caml_option = require("rescript/lib/js/caml_option.js"); function toString(chainId) { return String(chainId); } function makeUnsafe(chainId) { return chainId; } var Chain = { toString: toString, makeUnsafe: makeUnsafe }; var cmp = Caml.int_compare; var ChainIdCmp = Belt_Id.MakeComparableU({ cmp: cmp }); function fromArrayUnsafe(arr) { return Belt_Map.fromArray(arr, ChainIdCmp); } function get(self, chain) { var v = Belt_Map.get(self, chain); if (v !== undefined) { return Caml_option.valFromOption(v); } else { return Js_exn.raiseError("No chain with id " + String(chain) + " found in chain map"); } } var set = Belt_Map.set; var values = Belt_Map.valuesToArray; var keys = Belt_Map.keysToArray; var entries = Belt_Map.toArray; var has = Belt_Map.has; var map = Belt_Map.map; var mapWithKey = Belt_Map.mapWithKey; var size = Belt_Map.size; function update(map, chain, updateFn) { return Belt_Map.update(map, chain, (function (opt) { return Belt_Option.map(opt, updateFn); })); } exports.Chain = Chain; exports.fromArrayUnsafe = fromArrayUnsafe; exports.get = get; exports.set = set; exports.values = values; exports.keys = keys; exports.entries = entries; exports.has = has; exports.map = map; exports.mapWithKey = mapWithKey; exports.size = size; exports.update = update; /* ChainIdCmp Not a pure module */