UNPKG

@bigmi/client

Version:

Reactive primitives for Bitcoin apps.

27 lines (26 loc) 806 B
//#region src/query/utils.ts function hashFn(queryKey) { return JSON.stringify(queryKey, (_, value) => { if (isPlainObject(value)) return Object.keys(value).sort().reduce((result, key) => { result[key] = value[key]; return result; }, {}); if (typeof value === "bigint") return value.toString(); return value; }); } function isPlainObject(value) { if (!hasObjectPrototype(value)) return false; const ctor = value.constructor; if (typeof ctor === "undefined") return true; const prot = ctor.prototype; if (!hasObjectPrototype(prot)) return false; if (!prot.hasOwnProperty("isPrototypeOf")) return false; return true; } function hasObjectPrototype(o) { return Object.prototype.toString.call(o) === "[object Object]"; } //#endregion export { hashFn }; //# sourceMappingURL=utils.js.map