UNPKG

@hazae41/glacier

Version:

Yet another React data (re)fetching library

76 lines (74 loc) 1.99 kB
var Identity; (function (Identity) { function encodeOrThrow(value) { return value; } Identity.encodeOrThrow = encodeOrThrow; function decodeOrThrow(value) { return value; } Identity.decodeOrThrow = decodeOrThrow; })(Identity || (Identity = {})); var Jsoned; (function (Jsoned) { function encodeOrThrow(value) { return JSON.stringify(value); } Jsoned.encodeOrThrow = encodeOrThrow; function decodeOrThrow(value) { return JSON.parse(value); } Jsoned.decodeOrThrow = decodeOrThrow; })(Jsoned || (Jsoned = {})); class AsyncPipeBicoder { outer; inner; constructor(outer, inner) { this.outer = outer; this.inner = inner; } async encodeOrThrow(input) { return await this.inner.encodeOrThrow(await this.outer.encodeOrThrow(input)); } async decodeOrThrow(output) { return await this.outer.decodeOrThrow(await this.inner.decodeOrThrow(output)); } } class AsyncPipeEncoder { outer; inner; constructor(outer, inner) { this.outer = outer; this.inner = inner; } async encodeOrThrow(input) { return await this.inner.encodeOrThrow(await this.outer.encodeOrThrow(input)); } } class SyncPipeBicoder { outer; inner; constructor(outer, inner) { this.outer = outer; this.inner = inner; } encodeOrThrow(input) { return this.inner.encodeOrThrow(this.outer.encodeOrThrow(input)); } decodeOrThrow(output) { return this.outer.decodeOrThrow(this.inner.decodeOrThrow(output)); } } class SyncPipeEncoder { outer; inner; constructor(outer, inner) { this.outer = outer; this.inner = inner; } encodeOrThrow(input) { return this.inner.encodeOrThrow(this.outer.encodeOrThrow(input)); } } export { AsyncPipeBicoder, AsyncPipeEncoder, Identity, Jsoned, SyncPipeBicoder, SyncPipeEncoder }; //# sourceMappingURL=coder.mjs.map