@coinset/bitmart
Version:
Universal BitMart API client
17 lines • 532 B
JavaScript
import * as denoShim from "deno.ns";
export const jsonFetch = async (url, init, options) => {
const res = await denoShim.fetch(url.toString(), init);
if (!res.ok) {
throw Error(res.statusText);
}
const text = await res.text();
const parsed = JSON.parse(text, options?.parseJson);
if ("code" in parsed && parsed.code !== 1000) {
throw Error(parsed.message);
}
return parsed;
};
export function isSnakeCase(value) {
return /\w+_\w+/.test(value);
}
//# sourceMappingURL=_utils.js.map