UNPKG

@hazae41/glacier

Version:

Yet another React data (re)fetching library

81 lines (78 loc) 2.14 kB
'use strict'; exports.Identity = void 0; (function (Identity) { function encodeOrThrow(value) { return value; } Identity.encodeOrThrow = encodeOrThrow; function decodeOrThrow(value) { return value; } Identity.decodeOrThrow = decodeOrThrow; })(exports.Identity || (exports.Identity = {})); exports.Jsoned = void 0; (function (Jsoned) { function encodeOrThrow(value) { return JSON.stringify(value); } Jsoned.encodeOrThrow = encodeOrThrow; function decodeOrThrow(value) { return JSON.parse(value); } Jsoned.decodeOrThrow = decodeOrThrow; })(exports.Jsoned || (exports.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)); } } exports.AsyncPipeBicoder = AsyncPipeBicoder; exports.AsyncPipeEncoder = AsyncPipeEncoder; exports.SyncPipeBicoder = SyncPipeBicoder; exports.SyncPipeEncoder = SyncPipeEncoder; //# sourceMappingURL=coder.cjs.map