UNPKG

envio

Version:

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

79 lines (60 loc) 1.67 kB
// Generated by ReScript, PLEASE EDIT WITH CARE import * as Belt_Id from "@rescript/runtime/lib/es6/Belt_Id.js"; import * as Belt_Map from "@rescript/runtime/lib/es6/Belt_Map.js"; import * as Primitive_int from "@rescript/runtime/lib/es6/Primitive_int.js"; import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js"; import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js"; import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js"; function toString(chainId) { return chainId.toString(); } function makeUnsafe(chainId) { return chainId; } let Chain = { toString: toString, makeUnsafe: makeUnsafe }; function cmp(a, b) { return Primitive_int.compare(a, b) | 0; } let ChainIdCmp = Belt_Id.MakeComparable({ cmp: cmp }); function fromArrayUnsafe(arr) { return Belt_Map.fromArray(arr, ChainIdCmp); } function get(self, chain) { let v = Belt_Map.get(self, chain); if (v !== undefined) { return Primitive_option.valFromOption(v); } else { return Stdlib_JsError.throwWithMessage("No chain with id " + chain.toString() + " found in chain map"); } } let set = Belt_Map.set; let values = Belt_Map.valuesToArray; let keys = Belt_Map.keysToArray; let entries = Belt_Map.toArray; let has = Belt_Map.has; let map = Belt_Map.map; let mapWithKey = Belt_Map.mapWithKey; let size = Belt_Map.size; function update(map, chain, updateFn) { return Belt_Map.update(map, chain, opt => Stdlib_Option.map(opt, updateFn)); } export { Chain, fromArrayUnsafe, get, set, values, keys, entries, has, map, mapWithKey, size, update, } /* ChainIdCmp Not a pure module */